diff --git a/.fern/metadata.json b/.fern/metadata.json index 22890ea6..1b6b24b5 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,7 +1,7 @@ { - "cliVersion": "2.8.1", + "cliVersion": "3.38.0", "generatorName": "fernapi/fern-java-sdk", - "generatorVersion": "3.19.0", + "generatorVersion": "3.27.6", "generatorConfig": { "base-api-exception-class-name": "SquareApiException", "base-exception-class-name": "SquareException", @@ -12,5 +12,6 @@ "package-layout": "flat", "enable-forward-compatible-enums": true, "publish-to": "central" - } + }, + "sdkVersion": "46.0.0.20260122" } \ No newline at end of file diff --git a/LICENSE b/LICENSE index f5669d1d..878ffc14 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2025 Square. +Copyright (c) 2026 Square. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 39371ac7..2dd51f47 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ Add the dependency in your `pom.xml` file: com.squareup square - 45.2.0.20251016 + 46.0.0.20260122 ``` @@ -361,8 +361,8 @@ Gradle: ```groovy dependencies { - implementation 'com.squareup:square:45.2.0.20251016' - implementation 'com.squareup:square-legacy:45.2.0.20251016' + implementation 'com.squareup:square:46.0.0.20260122' + implementation 'com.squareup:square-legacy:46.0.0.20260122' } ``` @@ -372,12 +372,12 @@ Maven: com.squareup square - 45.2.0.20251016 + 46.0.0.20260122 com.squareup square-legacy - 45.2.0.20251016 + 46.0.0.20260122 ``` @@ -432,7 +432,6 @@ SquareClient client = SquareClient ### Timeouts The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level. - ```java import com.squareup.square.SquareClient; import com.squareup.square.core.RequestOptions; @@ -440,7 +439,7 @@ import com.squareup.square.core.RequestOptions; // Client level SquareClient client = SquareClient .builder() - .timeout(10) + .timeout(60) .build(); // Request level @@ -448,7 +447,7 @@ client.payments().create( ..., RequestOptions .builder() - .timeout(10) + .timeout(60) .build() ); ``` diff --git a/build.gradle b/build.gradle index f9a4f2c0..022d7ecd 100644 --- a/build.gradle +++ b/build.gradle @@ -47,7 +47,7 @@ java { group = 'com.squareup' -version = '45.2.0.20251016' +version = '46.0.0.20260122' jar { dependsOn(":generatePomFileForMavenPublication") @@ -78,7 +78,7 @@ publishing { maven(MavenPublication) { groupId = 'com.squareup' artifactId = 'square' - version = '45.2.0.20251016' + version = '46.0.0.20260122' from components.java pom { name = 'square' diff --git a/reference.md b/reference.md index cad48580..65188fe0 100644 --- a/reference.md +++ b/reference.md @@ -1,78 +1,4 @@ # Reference -## Mobile -
client.mobile.authorizationCode(request) -> CreateMobileAuthorizationCodeResponse -
-
- -#### 📝 Description - -
-
- -
-
- -__Note:__ This endpoint is used by the deprecated Reader SDK. -Developers should update their integration to use the [Mobile Payments SDK](https://developer.squareup.com/docs/mobile-payments-sdk), which includes its own authorization methods. - -Generates code to authorize a mobile application to connect to a Square card reader. - -Authorization codes are one-time-use codes and expire 60 minutes after being issued. - -The `Authorization` header you provide to this endpoint must have the following format: - -``` -Authorization: Bearer ACCESS_TOKEN -``` - -Replace `ACCESS_TOKEN` with a -[valid production authorization credential](https://developer.squareup.com/docs/build-basics/access-tokens). -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.mobile().authorizationCode( - CreateMobileAuthorizationCodeRequest - .builder() - .locationId("YOUR_LOCATION_ID") - .build() -); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**locationId:** `Optional` — The Square location ID that the authorization code should be tied to. - -
-
-
-
- - -
-
-
- ## OAuth
client.oAuth.revokeToken(request) -> RevokeTokenResponse
@@ -386,6 +312,18 @@ provided in your authorization URL. Required for the PKCE flow if `grant_type` is `authorization_code`. + +
+ +
+
+ +**useJwt:** `Optional` + +Indicates whether to use a JWT (JSON Web Token) as the OAuth access token. +When set to `true`, the OAuth flow returns a JWT to your application, used in the +same way as a regular token. The default value is `false`. +
@@ -850,6 +788,7 @@ client.bankAccounts().list( .cursor("cursor") .limit(1) .locationId("location_id") + .customerId("customer_id") .build() ); ``` @@ -869,7 +808,7 @@ client.bankAccounts().list( **cursor:** `Optional` The pagination cursor returned by a previous call to this endpoint. -Use it in the next `ListBankAccounts` request to retrieve the next set +Use it in the next `ListBankAccounts` request to retrieve the next set of results. See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. @@ -882,8 +821,8 @@ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagin **limit:** `Optional` -Upper limit on the number of bank accounts to return in the response. -Currently, 1000 is the largest supported limit. You can specify a limit +Upper limit on the number of bank accounts to return in the response. +Currently, 1000 is the largest supported limit. You can specify a limit of up to 1000 bank accounts. This is also the default limit. @@ -894,9 +833,103 @@ of up to 1000 bank accounts. This is also the default limit. **locationId:** `Optional` -Location ID. You can specify this optional filter +Location ID. You can specify this optional filter to retrieve only the linked bank accounts belonging to a specific location. + + + +
+
+ +**customerId:** `Optional` + +Customer ID. You can specify this optional filter +to retrieve only the linked bank accounts belonging to a specific customer. + +
+
+ + + + + + +
+ +
client.bankAccounts.createBankAccount(request) -> CreateBankAccountResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Store a bank account on file for a square account +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.bankAccounts().createBankAccount( + CreateBankAccountRequest + .builder() + .idempotencyKey("4e43559a-f0fd-47d3-9da2-7ea1f97d94be") + .sourceId("bnon:CA4SEHsQwr0rx6DbWLD5BQaqMnoYAQ") + .customerId("HM3B2D5JKGZ69359BTEHXM2V8M") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**idempotencyKey:** `String` + +Unique ID. For more information, see the +[Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). + +
+
+ +
+
+ +**sourceId:** `String` + +The ID of the source that represents the bank account information to be stored. This field +accepts the payment token created by WebSDK + +
+
+ +
+
+ +**customerId:** `Optional` — The ID of the customer associated with the bank account to be stored. +
@@ -981,8 +1014,7 @@ Connect V1 ID of the desired `BankAccount`. For more information, see
-Returns details of a [BankAccount](entity:BankAccount) -linked to a Square account. +Retrieve details of a [BankAccount](entity:BankAccount) bank account linked to a Square account.
@@ -1025,6 +1057,65 @@ client.bankAccounts().get(
+ + +
+ +
client.bankAccounts.disableBankAccount(bankAccountId) -> DisableBankAccountResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Disable a bank account. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.bankAccounts().disableBankAccount( + DisableBankAccountRequest + .builder() + .bankAccountId("bank_account_id") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**bankAccountId:** `String` — The ID of the bank account to disable. + +
+
+
+
+ +
@@ -11410,6 +11501,8 @@ The amount must be specified in the smallest denomination of the applicable curr (for example, US dollar amounts are specified in cents). For more information, see [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts). +Tips for external vendors such as a 3rd party delivery courier must be recorded using Order.service_charges. + The currency code must match the currency associated with the business that is accepting the payment. @@ -16042,14 +16135,14 @@ client.transferOrders().receive( Arrays.asList( TransferOrderGoodsReceiptLineItem .builder() - .transferOrderLineUid("transfer_order_line_uid") + .transferOrderLineUid("1") .quantityReceived("3") .quantityDamaged("1") .quantityCanceled("1") .build(), TransferOrderGoodsReceiptLineItem .builder() - .transferOrderLineUid("transfer_order_line_uid") + .transferOrderLineUid("2") .quantityReceived("2") .quantityCanceled("1") .build() @@ -16758,6 +16851,32 @@ client.vendors().update( + + + + +## Mobile +
client.mobile.authorizationCode() +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.mobile().authorizationCode(); +``` +
+
+
+
+ +
diff --git a/src/main/java/com/squareup/square/AsyncBankAccountsClient.java b/src/main/java/com/squareup/square/AsyncBankAccountsClient.java index 5877a504..49f69d9c 100644 --- a/src/main/java/com/squareup/square/AsyncBankAccountsClient.java +++ b/src/main/java/com/squareup/square/AsyncBankAccountsClient.java @@ -7,6 +7,10 @@ import com.squareup.square.core.RequestOptions; import com.squareup.square.core.SyncPagingIterable; import com.squareup.square.types.BankAccount; +import com.squareup.square.types.CreateBankAccountRequest; +import com.squareup.square.types.CreateBankAccountResponse; +import com.squareup.square.types.DisableBankAccountRequest; +import com.squareup.square.types.DisableBankAccountResponse; import com.squareup.square.types.GetBankAccountByV1IdResponse; import com.squareup.square.types.GetBankAccountResponse; import com.squareup.square.types.GetBankAccountsRequest; @@ -38,6 +42,13 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + /** + * Returns a list of BankAccount objects linked to a Square account. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + /** * Returns a list of BankAccount objects linked to a Square account. */ @@ -53,6 +64,21 @@ public CompletableFuture> list( return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); } + /** + * Store a bank account on file for a square account + */ + public CompletableFuture createBankAccount(CreateBankAccountRequest request) { + return this.rawClient.createBankAccount(request).thenApply(response -> response.body()); + } + + /** + * Store a bank account on file for a square account + */ + public CompletableFuture createBankAccount( + CreateBankAccountRequest request, RequestOptions requestOptions) { + return this.rawClient.createBankAccount(request, requestOptions).thenApply(response -> response.body()); + } + /** * Returns details of a BankAccount identified by V1 bank account ID. */ @@ -69,19 +95,32 @@ public CompletableFuture getByV1Id( } /** - * Returns details of a BankAccount - * linked to a Square account. + * Retrieve details of a BankAccount bank account linked to a Square account. */ public CompletableFuture get(GetBankAccountsRequest request) { return this.rawClient.get(request).thenApply(response -> response.body()); } /** - * Returns details of a BankAccount - * linked to a Square account. + * Retrieve details of a BankAccount bank account linked to a Square account. */ public CompletableFuture get( GetBankAccountsRequest request, RequestOptions requestOptions) { return this.rawClient.get(request, requestOptions).thenApply(response -> response.body()); } + + /** + * Disable a bank account. + */ + public CompletableFuture disableBankAccount(DisableBankAccountRequest request) { + return this.rawClient.disableBankAccount(request).thenApply(response -> response.body()); + } + + /** + * Disable a bank account. + */ + public CompletableFuture disableBankAccount( + DisableBankAccountRequest request, RequestOptions requestOptions) { + return this.rawClient.disableBankAccount(request, requestOptions).thenApply(response -> response.body()); + } } diff --git a/src/main/java/com/squareup/square/AsyncBookingsClient.java b/src/main/java/com/squareup/square/AsyncBookingsClient.java index aba467d2..768b9445 100644 --- a/src/main/java/com/squareup/square/AsyncBookingsClient.java +++ b/src/main/java/com/squareup/square/AsyncBookingsClient.java @@ -72,6 +72,15 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + /** + * Retrieve a collection of bookings. + *

To call this endpoint with buyer-level permissions, set APPOINTMENTS_READ for the OAuth scope. + * To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_READ and APPOINTMENTS_READ for the OAuth scope.

+ */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + /** * Retrieve a collection of bookings. *

To call this endpoint with buyer-level permissions, set APPOINTMENTS_READ for the OAuth scope. diff --git a/src/main/java/com/squareup/square/AsyncCardsClient.java b/src/main/java/com/squareup/square/AsyncCardsClient.java index 8aa15949..efbfcac3 100644 --- a/src/main/java/com/squareup/square/AsyncCardsClient.java +++ b/src/main/java/com/squareup/square/AsyncCardsClient.java @@ -41,6 +41,14 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + /** + * Retrieves a list of cards owned by the account making the request. + * A max of 25 cards will be returned. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + /** * Retrieves a list of cards owned by the account making the request. * A max of 25 cards will be returned. diff --git a/src/main/java/com/squareup/square/AsyncCatalogClient.java b/src/main/java/com/squareup/square/AsyncCatalogClient.java index 5e174f3b..8d7f7df5 100644 --- a/src/main/java/com/squareup/square/AsyncCatalogClient.java +++ b/src/main/java/com/squareup/square/AsyncCatalogClient.java @@ -179,6 +179,18 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + /** + * Returns a list of all CatalogObjects of the specified types in the catalog. + *

The types parameter is specified as a comma-separated list of the CatalogObjectType values, + * for example, "ITEM, ITEM_VARIATION, MODIFIER, MODIFIER_LIST, CATEGORY, DISCOUNT, TAX, IMAGE".

+ *

Important: ListCatalog does not return deleted catalog items. To retrieve + * deleted catalog items, use SearchCatalogObjects + * and set the include_deleted_objects attribute value to true.

+ */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + /** * Returns a list of all CatalogObjects of the specified types in the catalog. *

The types parameter is specified as a comma-separated list of the CatalogObjectType values, @@ -220,6 +232,22 @@ public CompletableFuture search() { return this.rawClient.search().thenApply(response -> response.body()); } + /** + * Searches for CatalogObject of any type by matching supported search attribute values, + * excluding custom attribute values on items or item variations, against one or more of the specified query filters. + *

This (SearchCatalogObjects) endpoint differs from the SearchCatalogItems + * endpoint in the following aspects:

+ *
    + *
  • SearchCatalogItems can only search for items or item variations, whereas SearchCatalogObjects can search for any type of catalog objects.
  • + *
  • SearchCatalogItems supports the custom attribute query filters to return items or item variations that contain custom attribute values, where SearchCatalogObjects does not.
  • + *
  • SearchCatalogItems does not support the include_deleted_objects filter to search for deleted items or item variations, whereas SearchCatalogObjects does.
  • + *
  • The both endpoints have different call conventions, including the query filter formats.
  • + *
+ */ + public CompletableFuture search(RequestOptions requestOptions) { + return this.rawClient.search(requestOptions).thenApply(response -> response.body()); + } + /** * Searches for CatalogObject of any type by matching supported search attribute values, * excluding custom attribute values on items or item variations, against one or more of the specified query filters. @@ -269,6 +297,22 @@ public CompletableFuture searchItems() { return this.rawClient.searchItems().thenApply(response -> response.body()); } + /** + * Searches for catalog items or item variations by matching supported search attribute values, including + * custom attribute values, against one or more of the specified query filters. + *

This (SearchCatalogItems) endpoint differs from the SearchCatalogObjects + * endpoint in the following aspects:

+ *
    + *
  • SearchCatalogItems can only search for items or item variations, whereas SearchCatalogObjects can search for any type of catalog objects.
  • + *
  • SearchCatalogItems supports the custom attribute query filters to return items or item variations that contain custom attribute values, where SearchCatalogObjects does not.
  • + *
  • SearchCatalogItems does not support the include_deleted_objects filter to search for deleted items or item variations, whereas SearchCatalogObjects does.
  • + *
  • The both endpoints use different call conventions, including the query filter formats.
  • + *
+ */ + public CompletableFuture searchItems(RequestOptions requestOptions) { + return this.rawClient.searchItems(requestOptions).thenApply(response -> response.body()); + } + /** * Searches for catalog items or item variations by matching supported search attribute values, including * custom attribute values, against one or more of the specified query filters. diff --git a/src/main/java/com/squareup/square/AsyncChannelsClient.java b/src/main/java/com/squareup/square/AsyncChannelsClient.java index 5d1c9280..f60cff5e 100644 --- a/src/main/java/com/squareup/square/AsyncChannelsClient.java +++ b/src/main/java/com/squareup/square/AsyncChannelsClient.java @@ -35,6 +35,10 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture> list(ListChannelsRequest request) { return this.rawClient.list(request).thenApply(response -> response.body()); } diff --git a/src/main/java/com/squareup/square/AsyncCustomersClient.java b/src/main/java/com/squareup/square/AsyncCustomersClient.java index 60953130..a3047518 100644 --- a/src/main/java/com/squareup/square/AsyncCustomersClient.java +++ b/src/main/java/com/squareup/square/AsyncCustomersClient.java @@ -78,6 +78,16 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + /** + * Lists customer profiles associated with a Square account. + *

Under normal operating conditions, newly created or updated customer profiles become available + * for the listing operation in well under 30 seconds. Occasionally, propagation of the new or updated + * profiles can take closer to one minute or longer, especially during network incidents and outages.

+ */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + /** * Lists customer profiles associated with a Square account. *

Under normal operating conditions, newly created or updated customer profiles become available @@ -115,6 +125,22 @@ public CompletableFuture create() { return this.rawClient.create().thenApply(response -> response.body()); } + /** + * Creates a new customer for a business. + *

You must provide at least one of the following values in your request to this + * endpoint:

+ *
    + *
  • given_name
  • + *
  • family_name
  • + *
  • company_name
  • + *
  • email_address
  • + *
  • phone_number
  • + *
+ */ + public CompletableFuture create(RequestOptions requestOptions) { + return this.rawClient.create(requestOptions).thenApply(response -> response.body()); + } + /** * Creates a new customer for a business. *

You must provide at least one of the following values in your request to this @@ -246,6 +272,19 @@ public CompletableFuture search() { return this.rawClient.search().thenApply(response -> response.body()); } + /** + * Searches the customer profiles associated with a Square account using one or more supported query filters. + *

Calling SearchCustomers without any explicit query filter returns all + * customer profiles ordered alphabetically based on given_name and + * family_name.

+ *

Under normal operating conditions, newly created or updated customer profiles become available + * for the search operation in well under 30 seconds. Occasionally, propagation of the new or updated + * profiles can take closer to one minute or longer, especially during network incidents and outages.

+ */ + public CompletableFuture search(RequestOptions requestOptions) { + return this.rawClient.search(requestOptions).thenApply(response -> response.body()); + } + /** * Searches the customer profiles associated with a Square account using one or more supported query filters. *

Calling SearchCustomers without any explicit query filter returns all diff --git a/src/main/java/com/squareup/square/AsyncDevicesClient.java b/src/main/java/com/squareup/square/AsyncDevicesClient.java index fadb420c..5a107aaa 100644 --- a/src/main/java/com/squareup/square/AsyncDevicesClient.java +++ b/src/main/java/com/squareup/square/AsyncDevicesClient.java @@ -43,6 +43,14 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + /** + * List devices associated with the merchant. Currently, only Terminal API + * devices are supported. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + /** * List devices associated with the merchant. Currently, only Terminal API * devices are supported. diff --git a/src/main/java/com/squareup/square/AsyncDisputesClient.java b/src/main/java/com/squareup/square/AsyncDisputesClient.java index 614412a1..30d0adb9 100644 --- a/src/main/java/com/squareup/square/AsyncDisputesClient.java +++ b/src/main/java/com/squareup/square/AsyncDisputesClient.java @@ -50,6 +50,13 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + /** + * Returns a list of disputes associated with a particular account. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + /** * Returns a list of disputes associated with a particular account. */ diff --git a/src/main/java/com/squareup/square/AsyncEmployeesClient.java b/src/main/java/com/squareup/square/AsyncEmployeesClient.java index 145086ee..b3ccab23 100644 --- a/src/main/java/com/squareup/square/AsyncEmployeesClient.java +++ b/src/main/java/com/squareup/square/AsyncEmployeesClient.java @@ -33,6 +33,10 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + public CompletableFuture> list(ListEmployeesRequest request) { return this.rawClient.list(request).thenApply(response -> response.body()); } diff --git a/src/main/java/com/squareup/square/AsyncEventsClient.java b/src/main/java/com/squareup/square/AsyncEventsClient.java index d234bad3..c7e62f53 100644 --- a/src/main/java/com/squareup/square/AsyncEventsClient.java +++ b/src/main/java/com/squareup/square/AsyncEventsClient.java @@ -37,6 +37,13 @@ public CompletableFuture searchEvents() { return this.rawClient.searchEvents().thenApply(response -> response.body()); } + /** + * Search for Square API events that occur within a 28-day timeframe. + */ + public CompletableFuture searchEvents(RequestOptions requestOptions) { + return this.rawClient.searchEvents(requestOptions).thenApply(response -> response.body()); + } + /** * Search for Square API events that occur within a 28-day timeframe. */ @@ -91,6 +98,13 @@ public CompletableFuture listEventTypes() { return this.rawClient.listEventTypes().thenApply(response -> response.body()); } + /** + * Lists all event types that you can subscribe to as webhooks or query using the Events API. + */ + public CompletableFuture listEventTypes(RequestOptions requestOptions) { + return this.rawClient.listEventTypes(requestOptions).thenApply(response -> response.body()); + } + /** * Lists all event types that you can subscribe to as webhooks or query using the Events API. */ diff --git a/src/main/java/com/squareup/square/AsyncGiftCardsClient.java b/src/main/java/com/squareup/square/AsyncGiftCardsClient.java index 11765160..9934b68f 100644 --- a/src/main/java/com/squareup/square/AsyncGiftCardsClient.java +++ b/src/main/java/com/squareup/square/AsyncGiftCardsClient.java @@ -53,6 +53,14 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + /** + * Lists all gift cards. You can specify optional filters to retrieve + * a subset of the gift cards. Results are sorted by created_at in ascending order. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + /** * Lists all gift cards. You can specify optional filters to retrieve * a subset of the gift cards. Results are sorted by created_at in ascending order. diff --git a/src/main/java/com/squareup/square/AsyncInventoryClient.java b/src/main/java/com/squareup/square/AsyncInventoryClient.java index 59ec2fad..51a1eb9e 100644 --- a/src/main/java/com/squareup/square/AsyncInventoryClient.java +++ b/src/main/java/com/squareup/square/AsyncInventoryClient.java @@ -103,6 +103,15 @@ public CompletableFuture deprecatedBatchGetCha return this.rawClient.deprecatedBatchGetChanges().thenApply(response -> response.body()); } + /** + * Deprecated version of BatchRetrieveInventoryChanges after the endpoint URL + * is updated to conform to the standard convention. + */ + public CompletableFuture deprecatedBatchGetChanges( + RequestOptions requestOptions) { + return this.rawClient.deprecatedBatchGetChanges(requestOptions).thenApply(response -> response.body()); + } + /** * Deprecated version of BatchRetrieveInventoryChanges after the endpoint URL * is updated to conform to the standard convention. @@ -129,6 +138,14 @@ public CompletableFuture deprecatedBatchGetCoun return this.rawClient.deprecatedBatchGetCounts().thenApply(response -> response.body()); } + /** + * Deprecated version of BatchRetrieveInventoryCounts after the endpoint URL + * is updated to conform to the standard convention. + */ + public CompletableFuture deprecatedBatchGetCounts(RequestOptions requestOptions) { + return this.rawClient.deprecatedBatchGetCounts(requestOptions).thenApply(response -> response.body()); + } + /** * Deprecated version of BatchRetrieveInventoryCounts after the endpoint URL * is updated to conform to the standard convention. @@ -180,6 +197,18 @@ public CompletableFuture> batchGetChanges() return this.rawClient.batchGetChanges().thenApply(response -> response.body()); } + /** + * Returns historical physical counts and adjustments based on the + * provided filter criteria. + *

Results are paginated and sorted in ascending order according their + * occurred_at timestamp (oldest first).

+ *

BatchRetrieveInventoryChanges is a catch-all query endpoint for queries + * that cannot be handled by other, simpler endpoints.

+ */ + public CompletableFuture> batchGetChanges(RequestOptions requestOptions) { + return this.rawClient.batchGetChanges(requestOptions).thenApply(response -> response.body()); + } + /** * Returns historical physical counts and adjustments based on the * provided filter criteria. @@ -221,6 +250,21 @@ public CompletableFuture> batchGetCounts() { return this.rawClient.batchGetCounts().thenApply(response -> response.body()); } + /** + * Returns current counts for the provided + * CatalogObjects at the requested + * Locations. + *

Results are paginated and sorted in descending order according to their + * calculated_at timestamp (newest first).

+ *

When updated_after is specified, only counts that have changed since that + * time (based on the server timestamp for the most recent change) are + * returned. This allows clients to perform a "sync" operation, for example + * in response to receiving a Webhook notification.

+ */ + public CompletableFuture> batchGetCounts(RequestOptions requestOptions) { + return this.rawClient.batchGetCounts(requestOptions).thenApply(response -> response.body()); + } + /** * Returns current counts for the provided * CatalogObjects at the requested diff --git a/src/main/java/com/squareup/square/AsyncLaborClient.java b/src/main/java/com/squareup/square/AsyncLaborClient.java index 83864ef1..0f4339f0 100644 --- a/src/main/java/com/squareup/square/AsyncLaborClient.java +++ b/src/main/java/com/squareup/square/AsyncLaborClient.java @@ -133,6 +133,14 @@ public CompletableFuture searchScheduledShifts() return this.rawClient.searchScheduledShifts().thenApply(response -> response.body()); } + /** + * Returns a paginated list of scheduled shifts, with optional filter and sort settings. + * By default, results are sorted by start_at in ascending order. + */ + public CompletableFuture searchScheduledShifts(RequestOptions requestOptions) { + return this.rawClient.searchScheduledShifts(requestOptions).thenApply(response -> response.body()); + } + /** * Returns a paginated list of scheduled shifts, with optional filter and sort settings. * By default, results are sorted by start_at in ascending order. @@ -294,6 +302,29 @@ public CompletableFuture searchTimecards() { return this.rawClient.searchTimecards().thenApply(response -> response.body()); } + /** + * Returns a paginated list of Timecard records for a business. + * The list to be returned can be filtered by: + *
    + *
  • Location IDs
  • + *
  • Team member IDs
  • + *
  • Timecard status (OPEN or CLOSED)
  • + *
  • Timecard start
  • + *
  • Timecard end
  • + *
  • Workday details
  • + *
+ *

The list can be sorted by:

+ *
    + *
  • START_AT
  • + *
  • END_AT
  • + *
  • CREATED_AT
  • + *
  • UPDATED_AT
  • + *
+ */ + public CompletableFuture searchTimecards(RequestOptions requestOptions) { + return this.rawClient.searchTimecards(requestOptions).thenApply(response -> response.body()); + } + /** * Returns a paginated list of Timecard records for a business. * The list to be returned can be filtered by: diff --git a/src/main/java/com/squareup/square/AsyncLocationsClient.java b/src/main/java/com/squareup/square/AsyncLocationsClient.java index 94b5e1f9..70c9d0e8 100644 --- a/src/main/java/com/squareup/square/AsyncLocationsClient.java +++ b/src/main/java/com/squareup/square/AsyncLocationsClient.java @@ -77,6 +77,19 @@ public CompletableFuture create() { return this.rawClient.create().thenApply(response -> response.body()); } + /** + * Creates a location. + * Creating new locations allows for separate configuration of receipt layouts, item prices, + * and sales reports. Developers can use locations to separate sales activity through applications + * that integrate with Square from sales activity elsewhere in a seller's account. + * Locations created programmatically with the Locations API last forever and + * are visible to the seller for their own management. Therefore, ensure that + * each location has a sensible and unique name. + */ + public CompletableFuture create(RequestOptions requestOptions) { + return this.rawClient.create(requestOptions).thenApply(response -> response.body()); + } + /** * Creates a location. * Creating new locations allows for separate configuration of receipt layouts, item prices, diff --git a/src/main/java/com/squareup/square/AsyncLoyaltyClient.java b/src/main/java/com/squareup/square/AsyncLoyaltyClient.java index 574c6516..73603e68 100644 --- a/src/main/java/com/squareup/square/AsyncLoyaltyClient.java +++ b/src/main/java/com/squareup/square/AsyncLoyaltyClient.java @@ -52,6 +52,18 @@ public CompletableFuture searchEvents() { return this.rawClient.searchEvents().thenApply(response -> response.body()); } + /** + * Searches for loyalty events. + *

A Square loyalty program maintains a ledger of events that occur during the lifetime of a + * buyer's loyalty account. Each change in the point balance + * (for example, points earned, points redeemed, and points expired) is + * recorded in the ledger. Using this endpoint, you can search the ledger for events.

+ *

Search results are sorted by created_at in descending order.

+ */ + public CompletableFuture searchEvents(RequestOptions requestOptions) { + return this.rawClient.searchEvents(requestOptions).thenApply(response -> response.body()); + } + /** * Searches for loyalty events. *

A Square loyalty program maintains a ledger of events that occur during the lifetime of a diff --git a/src/main/java/com/squareup/square/AsyncMerchantsClient.java b/src/main/java/com/squareup/square/AsyncMerchantsClient.java index 9394fca5..9406ac8a 100644 --- a/src/main/java/com/squareup/square/AsyncMerchantsClient.java +++ b/src/main/java/com/squareup/square/AsyncMerchantsClient.java @@ -54,6 +54,20 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + /** + * Provides details about the merchant associated with a given access token. + *

The access token used to connect your application to a Square seller is associated + * with a single merchant. That means that ListMerchants returns a list + * with a single Merchant object. You can specify your personal access token + * to get your own merchant information or specify an OAuth token to get the + * information for the merchant that granted your application access.

+ *

If you know the merchant ID, you can also use the RetrieveMerchant + * endpoint to retrieve the merchant information.

+ */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + /** * Provides details about the merchant associated with a given access token. *

The access token used to connect your application to a Square seller is associated diff --git a/src/main/java/com/squareup/square/AsyncMobileClient.java b/src/main/java/com/squareup/square/AsyncMobileClient.java index 0ed850de..1004e78d 100644 --- a/src/main/java/com/squareup/square/AsyncMobileClient.java +++ b/src/main/java/com/squareup/square/AsyncMobileClient.java @@ -5,8 +5,6 @@ import com.squareup.square.core.ClientOptions; import com.squareup.square.core.RequestOptions; -import com.squareup.square.types.CreateMobileAuthorizationCodeRequest; -import com.squareup.square.types.CreateMobileAuthorizationCodeResponse; import java.util.concurrent.CompletableFuture; public class AsyncMobileClient { @@ -26,50 +24,11 @@ public AsyncRawMobileClient withRawResponse() { return this.rawClient; } - /** - * Note: This endpoint is used by the deprecated Reader SDK. - * Developers should update their integration to use the Mobile Payments SDK, which includes its own authorization methods. - *

Generates code to authorize a mobile application to connect to a Square card reader.

- *

Authorization codes are one-time-use codes and expire 60 minutes after being issued.

- *

The Authorization header you provide to this endpoint must have the following format:

- *
Authorization: Bearer ACCESS_TOKEN
-     * 
- *

Replace ACCESS_TOKEN with a - * valid production authorization credential.

- */ - public CompletableFuture authorizationCode() { + public CompletableFuture authorizationCode() { return this.rawClient.authorizationCode().thenApply(response -> response.body()); } - /** - * Note: This endpoint is used by the deprecated Reader SDK. - * Developers should update their integration to use the Mobile Payments SDK, which includes its own authorization methods. - *

Generates code to authorize a mobile application to connect to a Square card reader.

- *

Authorization codes are one-time-use codes and expire 60 minutes after being issued.

- *

The Authorization header you provide to this endpoint must have the following format:

- *
Authorization: Bearer ACCESS_TOKEN
-     * 
- *

Replace ACCESS_TOKEN with a - * valid production authorization credential.

- */ - public CompletableFuture authorizationCode( - CreateMobileAuthorizationCodeRequest request) { - return this.rawClient.authorizationCode(request).thenApply(response -> response.body()); - } - - /** - * Note: This endpoint is used by the deprecated Reader SDK. - * Developers should update their integration to use the Mobile Payments SDK, which includes its own authorization methods. - *

Generates code to authorize a mobile application to connect to a Square card reader.

- *

Authorization codes are one-time-use codes and expire 60 minutes after being issued.

- *

The Authorization header you provide to this endpoint must have the following format:

- *
Authorization: Bearer ACCESS_TOKEN
-     * 
- *

Replace ACCESS_TOKEN with a - * valid production authorization credential.

- */ - public CompletableFuture authorizationCode( - CreateMobileAuthorizationCodeRequest request, RequestOptions requestOptions) { - return this.rawClient.authorizationCode(request, requestOptions).thenApply(response -> response.body()); + public CompletableFuture authorizationCode(RequestOptions requestOptions) { + return this.rawClient.authorizationCode(requestOptions).thenApply(response -> response.body()); } } diff --git a/src/main/java/com/squareup/square/AsyncOAuthClient.java b/src/main/java/com/squareup/square/AsyncOAuthClient.java index 5c6e2ce7..ffe68f17 100644 --- a/src/main/java/com/squareup/square/AsyncOAuthClient.java +++ b/src/main/java/com/squareup/square/AsyncOAuthClient.java @@ -44,6 +44,21 @@ public CompletableFuture revokeToken() { return this.rawClient.revokeToken().thenApply(response -> response.body()); } + /** + * Revokes an access token generated with the OAuth flow. + *

If an account has more than one OAuth access token for your application, this + * endpoint revokes all of them, regardless of which token you specify.

+ *

Important: The Authorization header for this endpoint must have the + * following format:

+ *
Authorization: Client APPLICATION_SECRET
+     * 
+ *

Replace APPLICATION_SECRET with the application secret on the OAuth + * page for your application in the Developer Dashboard.

+ */ + public CompletableFuture revokeToken(RequestOptions requestOptions) { + return this.rawClient.revokeToken(requestOptions).thenApply(response -> response.body()); + } + /** * Revokes an access token generated with the OAuth flow. *

If an account has more than one OAuth access token for your application, this diff --git a/src/main/java/com/squareup/square/AsyncOrdersClient.java b/src/main/java/com/squareup/square/AsyncOrdersClient.java index c614e34f..52e6fc46 100644 --- a/src/main/java/com/squareup/square/AsyncOrdersClient.java +++ b/src/main/java/com/squareup/square/AsyncOrdersClient.java @@ -62,6 +62,17 @@ public CompletableFuture create() { return this.rawClient.create().thenApply(response -> response.body()); } + /** + * Creates a new order that can include information about products for + * purchase and settings to apply to the purchase. + *

To pay for a created order, see + * Pay for Orders.

+ *

You can modify open orders using the UpdateOrder endpoint.

+ */ + public CompletableFuture create(RequestOptions requestOptions) { + return this.rawClient.create(requestOptions).thenApply(response -> response.body()); + } + /** * Creates a new order that can include information about products for * purchase and settings to apply to the purchase. @@ -152,6 +163,26 @@ public CompletableFuture search() { return this.rawClient.search().thenApply(response -> response.body()); } + /** + * Search all orders for one or more locations. Orders include all sales, + * returns, and exchanges regardless of how or when they entered the Square + * ecosystem (such as Point of Sale, Invoices, and Connect APIs). + *

SearchOrders requests need to specify which locations to search and define a + * SearchOrdersQuery object that controls + * how to sort or filter the results. Your SearchOrdersQuery can:

+ *

Set filter criteria. + * Set the sort order. + * Determine whether to return results as complete Order objects or as + * OrderEntry objects.

+ *

Note that details for orders processed with Square Point of Sale while in + * offline mode might not be transmitted to Square for up to 72 hours. Offline + * orders have a created_at value that reflects the time the order was created, + * not the time it was subsequently transmitted to Square.

+ */ + public CompletableFuture search(RequestOptions requestOptions) { + return this.rawClient.search(requestOptions).thenApply(response -> response.body()); + } + /** * Search all orders for one or more locations. Orders include all sales, * returns, and exchanges regardless of how or when they entered the Square diff --git a/src/main/java/com/squareup/square/AsyncPaymentsClient.java b/src/main/java/com/squareup/square/AsyncPaymentsClient.java index 213aa59e..d79ac6db 100644 --- a/src/main/java/com/squareup/square/AsyncPaymentsClient.java +++ b/src/main/java/com/squareup/square/AsyncPaymentsClient.java @@ -49,6 +49,16 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + /** + * Retrieves a list of payments taken by the account making the request. + *

Results are eventually consistent, and new payments or changes to payments might take several + * seconds to appear.

+ *

The maximum results per page is 100.

+ */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + /** * Retrieves a list of payments taken by the account making the request. *

Results are eventually consistent, and new payments or changes to payments might take several diff --git a/src/main/java/com/squareup/square/AsyncPayoutsClient.java b/src/main/java/com/squareup/square/AsyncPayoutsClient.java index 29a882dd..4268fe59 100644 --- a/src/main/java/com/squareup/square/AsyncPayoutsClient.java +++ b/src/main/java/com/squareup/square/AsyncPayoutsClient.java @@ -40,6 +40,15 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + /** + * Retrieves a list of all payouts for the default location. + * You can filter payouts by location ID, status, time range, and order them in ascending or descending order. + * To call this endpoint, set PAYOUTS_READ for the OAuth scope. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + /** * Retrieves a list of all payouts for the default location. * You can filter payouts by location ID, status, time range, and order them in ascending or descending order. diff --git a/src/main/java/com/squareup/square/AsyncRawBankAccountsClient.java b/src/main/java/com/squareup/square/AsyncRawBankAccountsClient.java index 94ad3043..93c04a34 100644 --- a/src/main/java/com/squareup/square/AsyncRawBankAccountsClient.java +++ b/src/main/java/com/squareup/square/AsyncRawBankAccountsClient.java @@ -3,7 +3,9 @@ */ package com.squareup.square; +import com.fasterxml.jackson.core.JsonProcessingException; import com.squareup.square.core.ClientOptions; +import com.squareup.square.core.MediaTypes; import com.squareup.square.core.ObjectMappers; import com.squareup.square.core.QueryStringMapper; import com.squareup.square.core.RequestOptions; @@ -12,6 +14,10 @@ import com.squareup.square.core.SquareException; import com.squareup.square.core.SyncPagingIterable; import com.squareup.square.types.BankAccount; +import com.squareup.square.types.CreateBankAccountRequest; +import com.squareup.square.types.CreateBankAccountResponse; +import com.squareup.square.types.DisableBankAccountRequest; +import com.squareup.square.types.DisableBankAccountResponse; import com.squareup.square.types.GetBankAccountByV1IdResponse; import com.squareup.square.types.GetBankAccountResponse; import com.squareup.square.types.GetBankAccountsRequest; @@ -30,6 +36,7 @@ import okhttp3.HttpUrl; import okhttp3.OkHttpClient; import okhttp3.Request; +import okhttp3.RequestBody; import okhttp3.Response; import okhttp3.ResponseBody; import org.jetbrains.annotations.NotNull; @@ -48,6 +55,14 @@ public CompletableFutureBankAccount objects linked to a Square account. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListBankAccountsRequest.builder().build(), requestOptions); + } + /** * Returns a list of BankAccount objects linked to a Square account. */ @@ -76,6 +91,10 @@ public CompletableFuture> createBankAccount( + CreateBankAccountRequest request) { + return createBankAccount(request, null); + } + + /** + * Store a bank account on file for a square account + */ + public CompletableFuture> createBankAccount( + CreateBankAccountRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v2/bank-accounts") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new SquareException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new SquareClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, CreateBankAccountResponse.class), + response)); + return; + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new SquareApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new SquareException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new SquareException("Network error executing HTTP request", e)); + } + }); + return future; + } + /** * Returns details of a BankAccount identified by V1 bank account ID. */ @@ -192,16 +276,14 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { } /** - * Returns details of a BankAccount - * linked to a Square account. + * Retrieve details of a BankAccount bank account linked to a Square account. */ public CompletableFuture> get(GetBankAccountsRequest request) { return get(request, null); } /** - * Returns details of a BankAccount - * linked to a Square account. + * Retrieve details of a BankAccount bank account linked to a Square account. */ public CompletableFuture> get( GetBankAccountsRequest request, RequestOptions requestOptions) { @@ -248,4 +330,63 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { }); return future; } + + /** + * Disable a bank account. + */ + public CompletableFuture> disableBankAccount( + DisableBankAccountRequest request) { + return disableBankAccount(request, null); + } + + /** + * Disable a bank account. + */ + public CompletableFuture> disableBankAccount( + DisableBankAccountRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v2/bank-accounts") + .addPathSegment(request.getBankAccountId()) + .addPathSegments("disable") + .build(); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new SquareClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, DisableBankAccountResponse.class), + response)); + return; + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new SquareApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new SquareException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new SquareException("Network error executing HTTP request", e)); + } + }); + return future; + } } diff --git a/src/main/java/com/squareup/square/AsyncRawBookingsClient.java b/src/main/java/com/squareup/square/AsyncRawBookingsClient.java index 1216b65b..387e78ec 100644 --- a/src/main/java/com/squareup/square/AsyncRawBookingsClient.java +++ b/src/main/java/com/squareup/square/AsyncRawBookingsClient.java @@ -66,6 +66,16 @@ public CompletableFuture>> return list(ListBookingsRequest.builder().build()); } + /** + * Retrieve a collection of bookings. + *

To call this endpoint with buyer-level permissions, set APPOINTMENTS_READ for the OAuth scope. + * To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_READ and APPOINTMENTS_READ for the OAuth scope.

+ */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListBookingsRequest.builder().build(), requestOptions); + } + /** * Retrieve a collection of bookings. *

To call this endpoint with buyer-level permissions, set APPOINTMENTS_READ for the OAuth scope. diff --git a/src/main/java/com/squareup/square/AsyncRawCardsClient.java b/src/main/java/com/squareup/square/AsyncRawCardsClient.java index b4368aad..f34826cb 100644 --- a/src/main/java/com/squareup/square/AsyncRawCardsClient.java +++ b/src/main/java/com/squareup/square/AsyncRawCardsClient.java @@ -54,6 +54,14 @@ public CompletableFuture>> lis return list(ListCardsRequest.builder().build()); } + /** + * Retrieves a list of cards owned by the account making the request. + * A max of 25 cards will be returned. + */ + public CompletableFuture>> list(RequestOptions requestOptions) { + return list(ListCardsRequest.builder().build(), requestOptions); + } + /** * Retrieves a list of cards owned by the account making the request. * A max of 25 cards will be returned. diff --git a/src/main/java/com/squareup/square/AsyncRawCatalogClient.java b/src/main/java/com/squareup/square/AsyncRawCatalogClient.java index d65f7705..290ef2de 100644 --- a/src/main/java/com/squareup/square/AsyncRawCatalogClient.java +++ b/src/main/java/com/squareup/square/AsyncRawCatalogClient.java @@ -374,6 +374,19 @@ public CompletableFutureCatalogObjects of the specified types in the catalog. + *

The types parameter is specified as a comma-separated list of the CatalogObjectType values, + * for example, "ITEM, ITEM_VARIATION, MODIFIER, MODIFIER_LIST, CATEGORY, DISCOUNT, TAX, IMAGE".

+ *

Important: ListCatalog does not return deleted catalog items. To retrieve + * deleted catalog items, use SearchCatalogObjects + * and set the include_deleted_objects attribute value to true.

+ */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListCatalogRequest.builder().build(), requestOptions); + } + /** * Returns a list of all CatalogObjects of the specified types in the catalog. *

The types parameter is specified as a comma-separated list of the CatalogObjectType values, @@ -485,6 +498,23 @@ public CompletableFuture> return search(SearchCatalogObjectsRequest.builder().build()); } + /** + * Searches for CatalogObject of any type by matching supported search attribute values, + * excluding custom attribute values on items or item variations, against one or more of the specified query filters. + *

This (SearchCatalogObjects) endpoint differs from the SearchCatalogItems + * endpoint in the following aspects:

+ *
    + *
  • SearchCatalogItems can only search for items or item variations, whereas SearchCatalogObjects can search for any type of catalog objects.
  • + *
  • SearchCatalogItems supports the custom attribute query filters to return items or item variations that contain custom attribute values, where SearchCatalogObjects does not.
  • + *
  • SearchCatalogItems does not support the include_deleted_objects filter to search for deleted items or item variations, whereas SearchCatalogObjects does.
  • + *
  • The both endpoints have different call conventions, including the query filter formats.
  • + *
+ */ + public CompletableFuture> search( + RequestOptions requestOptions) { + return search(SearchCatalogObjectsRequest.builder().build(), requestOptions); + } + /** * Searches for CatalogObject of any type by matching supported search attribute values, * excluding custom attribute values on items or item variations, against one or more of the specified query filters. @@ -584,6 +614,23 @@ public CompletableFuture> s return searchItems(SearchCatalogItemsRequest.builder().build()); } + /** + * Searches for catalog items or item variations by matching supported search attribute values, including + * custom attribute values, against one or more of the specified query filters. + *

This (SearchCatalogItems) endpoint differs from the SearchCatalogObjects + * endpoint in the following aspects:

+ *
    + *
  • SearchCatalogItems can only search for items or item variations, whereas SearchCatalogObjects can search for any type of catalog objects.
  • + *
  • SearchCatalogItems supports the custom attribute query filters to return items or item variations that contain custom attribute values, where SearchCatalogObjects does not.
  • + *
  • SearchCatalogItems does not support the include_deleted_objects filter to search for deleted items or item variations, whereas SearchCatalogObjects does.
  • + *
  • The both endpoints use different call conventions, including the query filter formats.
  • + *
+ */ + public CompletableFuture> searchItems( + RequestOptions requestOptions) { + return searchItems(SearchCatalogItemsRequest.builder().build(), requestOptions); + } + /** * Searches for catalog items or item variations by matching supported search attribute values, including * custom attribute values, against one or more of the specified query filters. diff --git a/src/main/java/com/squareup/square/AsyncRawChannelsClient.java b/src/main/java/com/squareup/square/AsyncRawChannelsClient.java index 9ca8fc0b..0beb2ce8 100644 --- a/src/main/java/com/squareup/square/AsyncRawChannelsClient.java +++ b/src/main/java/com/squareup/square/AsyncRawChannelsClient.java @@ -48,6 +48,11 @@ public CompletableFuture>> return list(ListChannelsRequest.builder().build()); } + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListChannelsRequest.builder().build(), requestOptions); + } + public CompletableFuture>> list(ListChannelsRequest request) { return list(request, null); } diff --git a/src/main/java/com/squareup/square/AsyncRawCustomersClient.java b/src/main/java/com/squareup/square/AsyncRawCustomersClient.java index 13a0b377..3746ac58 100644 --- a/src/main/java/com/squareup/square/AsyncRawCustomersClient.java +++ b/src/main/java/com/squareup/square/AsyncRawCustomersClient.java @@ -68,6 +68,17 @@ public CompletableFuture>> return list(ListCustomersRequest.builder().build()); } + /** + * Lists customer profiles associated with a Square account. + *

Under normal operating conditions, newly created or updated customer profiles become available + * for the listing operation in well under 30 seconds. Occasionally, propagation of the new or updated + * profiles can take closer to one minute or longer, especially during network incidents and outages.

+ */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListCustomersRequest.builder().build(), requestOptions); + } + /** * Lists customer profiles associated with a Square account. *

Under normal operating conditions, newly created or updated customer profiles become available @@ -182,6 +193,22 @@ public CompletableFuture> creat return create(CreateCustomerRequest.builder().build()); } + /** + * Creates a new customer for a business. + *

You must provide at least one of the following values in your request to this + * endpoint:

+ *
    + *
  • given_name
  • + *
  • family_name
  • + *
  • company_name
  • + *
  • email_address
  • + *
  • phone_number
  • + *
+ */ + public CompletableFuture> create(RequestOptions requestOptions) { + return create(CreateCustomerRequest.builder().build(), requestOptions); + } + /** * Creates a new customer for a business. *

You must provide at least one of the following values in your request to this @@ -560,6 +587,19 @@ public CompletableFuture> sear return search(SearchCustomersRequest.builder().build()); } + /** + * Searches the customer profiles associated with a Square account using one or more supported query filters. + *

Calling SearchCustomers without any explicit query filter returns all + * customer profiles ordered alphabetically based on given_name and + * family_name.

+ *

Under normal operating conditions, newly created or updated customer profiles become available + * for the search operation in well under 30 seconds. Occasionally, propagation of the new or updated + * profiles can take closer to one minute or longer, especially during network incidents and outages.

+ */ + public CompletableFuture> search(RequestOptions requestOptions) { + return search(SearchCustomersRequest.builder().build(), requestOptions); + } + /** * Searches the customer profiles associated with a Square account using one or more supported query filters. *

Calling SearchCustomers without any explicit query filter returns all diff --git a/src/main/java/com/squareup/square/AsyncRawDevicesClient.java b/src/main/java/com/squareup/square/AsyncRawDevicesClient.java index fbf38cb8..5dc7fd67 100644 --- a/src/main/java/com/squareup/square/AsyncRawDevicesClient.java +++ b/src/main/java/com/squareup/square/AsyncRawDevicesClient.java @@ -47,6 +47,14 @@ public CompletableFuture>> l return list(ListDevicesRequest.builder().build()); } + /** + * List devices associated with the merchant. Currently, only Terminal API + * devices are supported. + */ + public CompletableFuture>> list(RequestOptions requestOptions) { + return list(ListDevicesRequest.builder().build(), requestOptions); + } + /** * List devices associated with the merchant. Currently, only Terminal API * devices are supported. diff --git a/src/main/java/com/squareup/square/AsyncRawDisputesClient.java b/src/main/java/com/squareup/square/AsyncRawDisputesClient.java index c6a8e53d..a32662d8 100644 --- a/src/main/java/com/squareup/square/AsyncRawDisputesClient.java +++ b/src/main/java/com/squareup/square/AsyncRawDisputesClient.java @@ -60,6 +60,14 @@ public CompletableFuture>> return list(ListDisputesRequest.builder().build()); } + /** + * Returns a list of disputes associated with a particular account. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListDisputesRequest.builder().build(), requestOptions); + } + /** * Returns a list of disputes associated with a particular account. */ diff --git a/src/main/java/com/squareup/square/AsyncRawEmployeesClient.java b/src/main/java/com/squareup/square/AsyncRawEmployeesClient.java index 43f269f1..af975ef0 100644 --- a/src/main/java/com/squareup/square/AsyncRawEmployeesClient.java +++ b/src/main/java/com/squareup/square/AsyncRawEmployeesClient.java @@ -43,6 +43,11 @@ public CompletableFuture>> return list(ListEmployeesRequest.builder().build()); } + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListEmployeesRequest.builder().build(), requestOptions); + } + public CompletableFuture>> list( ListEmployeesRequest request) { return list(request, null); diff --git a/src/main/java/com/squareup/square/AsyncRawEventsClient.java b/src/main/java/com/squareup/square/AsyncRawEventsClient.java index dd4c3eb6..3aac832c 100644 --- a/src/main/java/com/squareup/square/AsyncRawEventsClient.java +++ b/src/main/java/com/squareup/square/AsyncRawEventsClient.java @@ -45,6 +45,14 @@ public CompletableFuture> searchE return searchEvents(SearchEventsRequest.builder().build()); } + /** + * Search for Square API events that occur within a 28-day timeframe. + */ + public CompletableFuture> searchEvents( + RequestOptions requestOptions) { + return searchEvents(SearchEventsRequest.builder().build(), requestOptions); + } + /** * Search for Square API events that occur within a 28-day timeframe. */ @@ -229,6 +237,14 @@ public CompletableFuture> listE return listEventTypes(ListEventTypesRequest.builder().build()); } + /** + * Lists all event types that you can subscribe to as webhooks or query using the Events API. + */ + public CompletableFuture> listEventTypes( + RequestOptions requestOptions) { + return listEventTypes(ListEventTypesRequest.builder().build(), requestOptions); + } + /** * Lists all event types that you can subscribe to as webhooks or query using the Events API. */ diff --git a/src/main/java/com/squareup/square/AsyncRawGiftCardsClient.java b/src/main/java/com/squareup/square/AsyncRawGiftCardsClient.java index 00ae0015..728ec6c0 100644 --- a/src/main/java/com/squareup/square/AsyncRawGiftCardsClient.java +++ b/src/main/java/com/squareup/square/AsyncRawGiftCardsClient.java @@ -60,6 +60,15 @@ public CompletableFuture>> return list(ListGiftCardsRequest.builder().build()); } + /** + * Lists all gift cards. You can specify optional filters to retrieve + * a subset of the gift cards. Results are sorted by created_at in ascending order. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListGiftCardsRequest.builder().build(), requestOptions); + } + /** * Lists all gift cards. You can specify optional filters to retrieve * a subset of the gift cards. Results are sorted by created_at in ascending order. diff --git a/src/main/java/com/squareup/square/AsyncRawInventoryClient.java b/src/main/java/com/squareup/square/AsyncRawInventoryClient.java index 6de8d935..17795c1a 100644 --- a/src/main/java/com/squareup/square/AsyncRawInventoryClient.java +++ b/src/main/java/com/squareup/square/AsyncRawInventoryClient.java @@ -253,6 +253,16 @@ public CompletableFutureBatchRetrieveInventoryChanges after the endpoint URL + * is updated to conform to the standard convention. + */ + public CompletableFuture> deprecatedBatchGetChanges( + RequestOptions requestOptions) { + return deprecatedBatchGetChanges( + BatchRetrieveInventoryChangesRequest.builder().build(), requestOptions); + } + /** * Deprecated version of BatchRetrieveInventoryChanges after the endpoint URL * is updated to conform to the standard convention. @@ -329,6 +339,15 @@ public CompletableFutureBatchRetrieveInventoryCounts after the endpoint URL + * is updated to conform to the standard convention. + */ + public CompletableFuture> deprecatedBatchGetCounts( + RequestOptions requestOptions) { + return deprecatedBatchGetCounts(BatchGetInventoryCountsRequest.builder().build(), requestOptions); + } + /** * Deprecated version of BatchRetrieveInventoryCounts after the endpoint URL * is updated to conform to the standard convention. @@ -479,6 +498,19 @@ public CompletableFutureResults are paginated and sorted in ascending order according their + * occurred_at timestamp (oldest first).

+ *

BatchRetrieveInventoryChanges is a catch-all query endpoint for queries + * that cannot be handled by other, simpler endpoints.

+ */ + public CompletableFuture>> batchGetChanges( + RequestOptions requestOptions) { + return batchGetChanges(BatchRetrieveInventoryChangesRequest.builder().build(), requestOptions); + } + /** * Returns historical physical counts and adjustments based on the * provided filter criteria. @@ -588,6 +620,22 @@ public CompletableFutureCatalogObjects at the requested + * Locations. + *

Results are paginated and sorted in descending order according to their + * calculated_at timestamp (newest first).

+ *

When updated_after is specified, only counts that have changed since that + * time (based on the server timestamp for the most recent change) are + * returned. This allows clients to perform a "sync" operation, for example + * in response to receiving a Webhook notification.

+ */ + public CompletableFuture>> batchGetCounts( + RequestOptions requestOptions) { + return batchGetCounts(BatchGetInventoryCountsRequest.builder().build(), requestOptions); + } + /** * Returns current counts for the provided * CatalogObjects at the requested diff --git a/src/main/java/com/squareup/square/AsyncRawLaborClient.java b/src/main/java/com/squareup/square/AsyncRawLaborClient.java index 83fe68d1..39757426 100644 --- a/src/main/java/com/squareup/square/AsyncRawLaborClient.java +++ b/src/main/java/com/squareup/square/AsyncRawLaborClient.java @@ -216,6 +216,15 @@ public CompletableFuture return searchScheduledShifts(SearchScheduledShiftsRequest.builder().build()); } + /** + * Returns a paginated list of scheduled shifts, with optional filter and sort settings. + * By default, results are sorted by start_at in ascending order. + */ + public CompletableFuture> searchScheduledShifts( + RequestOptions requestOptions) { + return searchScheduledShifts(SearchScheduledShiftsRequest.builder().build(), requestOptions); + } + /** * Returns a paginated list of scheduled shifts, with optional filter and sort settings. * By default, results are sorted by start_at in ascending order. @@ -619,6 +628,30 @@ public CompletableFuture> sear return searchTimecards(SearchTimecardsRequest.builder().build()); } + /** + * Returns a paginated list of Timecard records for a business. + * The list to be returned can be filtered by: + *
    + *
  • Location IDs
  • + *
  • Team member IDs
  • + *
  • Timecard status (OPEN or CLOSED)
  • + *
  • Timecard start
  • + *
  • Timecard end
  • + *
  • Workday details
  • + *
+ *

The list can be sorted by:

+ *
    + *
  • START_AT
  • + *
  • END_AT
  • + *
  • CREATED_AT
  • + *
  • UPDATED_AT
  • + *
+ */ + public CompletableFuture> searchTimecards( + RequestOptions requestOptions) { + return searchTimecards(SearchTimecardsRequest.builder().build(), requestOptions); + } + /** * Returns a paginated list of Timecard records for a business. * The list to be returned can be filtered by: diff --git a/src/main/java/com/squareup/square/AsyncRawLocationsClient.java b/src/main/java/com/squareup/square/AsyncRawLocationsClient.java index 553bd8b3..82187940 100644 --- a/src/main/java/com/squareup/square/AsyncRawLocationsClient.java +++ b/src/main/java/com/squareup/square/AsyncRawLocationsClient.java @@ -109,6 +109,19 @@ public CompletableFuture> creat return create(CreateLocationRequest.builder().build()); } + /** + * Creates a location. + * Creating new locations allows for separate configuration of receipt layouts, item prices, + * and sales reports. Developers can use locations to separate sales activity through applications + * that integrate with Square from sales activity elsewhere in a seller's account. + * Locations created programmatically with the Locations API last forever and + * are visible to the seller for their own management. Therefore, ensure that + * each location has a sensible and unique name. + */ + public CompletableFuture> create(RequestOptions requestOptions) { + return create(CreateLocationRequest.builder().build(), requestOptions); + } + /** * Creates a location. * Creating new locations allows for separate configuration of receipt layouts, item prices, diff --git a/src/main/java/com/squareup/square/AsyncRawLoyaltyClient.java b/src/main/java/com/squareup/square/AsyncRawLoyaltyClient.java index aa31a3d1..6e9a24a1 100644 --- a/src/main/java/com/squareup/square/AsyncRawLoyaltyClient.java +++ b/src/main/java/com/squareup/square/AsyncRawLoyaltyClient.java @@ -45,6 +45,19 @@ public CompletableFuture> return searchEvents(SearchLoyaltyEventsRequest.builder().build()); } + /** + * Searches for loyalty events. + *

A Square loyalty program maintains a ledger of events that occur during the lifetime of a + * buyer's loyalty account. Each change in the point balance + * (for example, points earned, points redeemed, and points expired) is + * recorded in the ledger. Using this endpoint, you can search the ledger for events.

+ *

Search results are sorted by created_at in descending order.

+ */ + public CompletableFuture> searchEvents( + RequestOptions requestOptions) { + return searchEvents(SearchLoyaltyEventsRequest.builder().build(), requestOptions); + } + /** * Searches for loyalty events. *

A Square loyalty program maintains a ledger of events that occur during the lifetime of a diff --git a/src/main/java/com/squareup/square/AsyncRawMerchantsClient.java b/src/main/java/com/squareup/square/AsyncRawMerchantsClient.java index 7683af5d..d62e1267 100644 --- a/src/main/java/com/squareup/square/AsyncRawMerchantsClient.java +++ b/src/main/java/com/squareup/square/AsyncRawMerchantsClient.java @@ -53,6 +53,21 @@ public CompletableFuture>> return list(ListMerchantsRequest.builder().build()); } + /** + * Provides details about the merchant associated with a given access token. + *

The access token used to connect your application to a Square seller is associated + * with a single merchant. That means that ListMerchants returns a list + * with a single Merchant object. You can specify your personal access token + * to get your own merchant information or specify an OAuth token to get the + * information for the merchant that granted your application access.

+ *

If you know the merchant ID, you can also use the RetrieveMerchant + * endpoint to retrieve the merchant information.

+ */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListMerchantsRequest.builder().build(), requestOptions); + } + /** * Provides details about the merchant associated with a given access token. *

The access token used to connect your application to a Square seller is associated diff --git a/src/main/java/com/squareup/square/AsyncRawMobileClient.java b/src/main/java/com/squareup/square/AsyncRawMobileClient.java index c6a5831b..1d22f7a5 100644 --- a/src/main/java/com/squareup/square/AsyncRawMobileClient.java +++ b/src/main/java/com/squareup/square/AsyncRawMobileClient.java @@ -3,16 +3,12 @@ */ package com.squareup.square; -import com.fasterxml.jackson.core.JsonProcessingException; import com.squareup.square.core.ClientOptions; -import com.squareup.square.core.MediaTypes; import com.squareup.square.core.ObjectMappers; import com.squareup.square.core.RequestOptions; import com.squareup.square.core.SquareApiException; import com.squareup.square.core.SquareClientHttpResponse; import com.squareup.square.core.SquareException; -import com.squareup.square.types.CreateMobileAuthorizationCodeRequest; -import com.squareup.square.types.CreateMobileAuthorizationCodeResponse; import java.io.IOException; import java.util.concurrent.CompletableFuture; import okhttp3.Call; @@ -33,86 +29,34 @@ public AsyncRawMobileClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - /** - * Note: This endpoint is used by the deprecated Reader SDK. - * Developers should update their integration to use the Mobile Payments SDK, which includes its own authorization methods. - *

Generates code to authorize a mobile application to connect to a Square card reader.

- *

Authorization codes are one-time-use codes and expire 60 minutes after being issued.

- *

The Authorization header you provide to this endpoint must have the following format:

- *
Authorization: Bearer ACCESS_TOKEN
-     * 
- *

Replace ACCESS_TOKEN with a - * valid production authorization credential.

- */ - public CompletableFuture> authorizationCode() { - return authorizationCode(CreateMobileAuthorizationCodeRequest.builder().build()); + public CompletableFuture> authorizationCode() { + return authorizationCode(null); } - /** - * Note: This endpoint is used by the deprecated Reader SDK. - * Developers should update their integration to use the Mobile Payments SDK, which includes its own authorization methods. - *

Generates code to authorize a mobile application to connect to a Square card reader.

- *

Authorization codes are one-time-use codes and expire 60 minutes after being issued.

- *

The Authorization header you provide to this endpoint must have the following format:

- *
Authorization: Bearer ACCESS_TOKEN
-     * 
- *

Replace ACCESS_TOKEN with a - * valid production authorization credential.

- */ - public CompletableFuture> authorizationCode( - CreateMobileAuthorizationCodeRequest request) { - return authorizationCode(request, null); - } - - /** - * Note: This endpoint is used by the deprecated Reader SDK. - * Developers should update their integration to use the Mobile Payments SDK, which includes its own authorization methods. - *

Generates code to authorize a mobile application to connect to a Square card reader.

- *

Authorization codes are one-time-use codes and expire 60 minutes after being issued.

- *

The Authorization header you provide to this endpoint must have the following format:

- *
Authorization: Bearer ACCESS_TOKEN
-     * 
- *

Replace ACCESS_TOKEN with a - * valid production authorization credential.

- */ - public CompletableFuture> authorizationCode( - CreateMobileAuthorizationCodeRequest request, RequestOptions requestOptions) { + public CompletableFuture> authorizationCode(RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("mobile/authorization-code") .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new SquareException("Failed to serialize request", e); - } Request okhttpRequest = new Request.Builder() .url(httpUrl) - .method("POST", body) + .method("POST", RequestBody.create("", null)) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = - new CompletableFuture<>(); + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new SquareClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, CreateMobileAuthorizationCodeResponse.class), - response)); + future.complete(new SquareClientHttpResponse<>(null, response)); return; } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); future.completeExceptionally(new SquareApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); diff --git a/src/main/java/com/squareup/square/AsyncRawOAuthClient.java b/src/main/java/com/squareup/square/AsyncRawOAuthClient.java index f05fe7e6..9d96fd9c 100644 --- a/src/main/java/com/squareup/square/AsyncRawOAuthClient.java +++ b/src/main/java/com/squareup/square/AsyncRawOAuthClient.java @@ -51,6 +51,21 @@ public CompletableFuture> revokeTo return revokeToken(RevokeTokenRequest.builder().build()); } + /** + * Revokes an access token generated with the OAuth flow. + *

If an account has more than one OAuth access token for your application, this + * endpoint revokes all of them, regardless of which token you specify.

+ *

Important: The Authorization header for this endpoint must have the + * following format:

+ *
Authorization: Client APPLICATION_SECRET
+     * 
+ *

Replace APPLICATION_SECRET with the application secret on the OAuth + * page for your application in the Developer Dashboard.

+ */ + public CompletableFuture> revokeToken(RequestOptions requestOptions) { + return revokeToken(RevokeTokenRequest.builder().build(), requestOptions); + } + /** * Revokes an access token generated with the OAuth flow. *

If an account has more than one OAuth access token for your application, this diff --git a/src/main/java/com/squareup/square/AsyncRawOrdersClient.java b/src/main/java/com/squareup/square/AsyncRawOrdersClient.java index 990b8541..7704a402 100644 --- a/src/main/java/com/squareup/square/AsyncRawOrdersClient.java +++ b/src/main/java/com/squareup/square/AsyncRawOrdersClient.java @@ -58,6 +58,17 @@ public CompletableFuture> create() return create(CreateOrderRequest.builder().build()); } + /** + * Creates a new order that can include information about products for + * purchase and settings to apply to the purchase. + *

To pay for a created order, see + * Pay for Orders.

+ *

You can modify open orders using the UpdateOrder endpoint.

+ */ + public CompletableFuture> create(RequestOptions requestOptions) { + return create(CreateOrderRequest.builder().build(), requestOptions); + } + /** * Creates a new order that can include information about products for * purchase and settings to apply to the purchase. @@ -343,6 +354,26 @@ public CompletableFuture> search( return search(SearchOrdersRequest.builder().build()); } + /** + * Search all orders for one or more locations. Orders include all sales, + * returns, and exchanges regardless of how or when they entered the Square + * ecosystem (such as Point of Sale, Invoices, and Connect APIs). + *

SearchOrders requests need to specify which locations to search and define a + * SearchOrdersQuery object that controls + * how to sort or filter the results. Your SearchOrdersQuery can:

+ *

Set filter criteria. + * Set the sort order. + * Determine whether to return results as complete Order objects or as + * OrderEntry objects.

+ *

Note that details for orders processed with Square Point of Sale while in + * offline mode might not be transmitted to Square for up to 72 hours. Offline + * orders have a created_at value that reflects the time the order was created, + * not the time it was subsequently transmitted to Square.

+ */ + public CompletableFuture> search(RequestOptions requestOptions) { + return search(SearchOrdersRequest.builder().build(), requestOptions); + } + /** * Search all orders for one or more locations. Orders include all sales, * returns, and exchanges regardless of how or when they entered the Square diff --git a/src/main/java/com/squareup/square/AsyncRawPaymentsClient.java b/src/main/java/com/squareup/square/AsyncRawPaymentsClient.java index 7b191908..7409b66c 100644 --- a/src/main/java/com/squareup/square/AsyncRawPaymentsClient.java +++ b/src/main/java/com/squareup/square/AsyncRawPaymentsClient.java @@ -62,6 +62,17 @@ public CompletableFuture>> return list(ListPaymentsRequest.builder().build()); } + /** + * Retrieves a list of payments taken by the account making the request. + *

Results are eventually consistent, and new payments or changes to payments might take several + * seconds to appear.

+ *

The maximum results per page is 100.

+ */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListPaymentsRequest.builder().build(), requestOptions); + } + /** * Retrieves a list of payments taken by the account making the request. *

Results are eventually consistent, and new payments or changes to payments might take several diff --git a/src/main/java/com/squareup/square/AsyncRawPayoutsClient.java b/src/main/java/com/squareup/square/AsyncRawPayoutsClient.java index ff14e1d8..c652bbaf 100644 --- a/src/main/java/com/squareup/square/AsyncRawPayoutsClient.java +++ b/src/main/java/com/squareup/square/AsyncRawPayoutsClient.java @@ -51,6 +51,15 @@ public CompletableFuture>> l return list(ListPayoutsRequest.builder().build()); } + /** + * Retrieves a list of all payouts for the default location. + * You can filter payouts by location ID, status, time range, and order them in ascending or descending order. + * To call this endpoint, set PAYOUTS_READ for the OAuth scope. + */ + public CompletableFuture>> list(RequestOptions requestOptions) { + return list(ListPayoutsRequest.builder().build(), requestOptions); + } + /** * Retrieves a list of all payouts for the default location. * You can filter payouts by location ID, status, time range, and order them in ascending or descending order. diff --git a/src/main/java/com/squareup/square/AsyncRawRefundsClient.java b/src/main/java/com/squareup/square/AsyncRawRefundsClient.java index af462e63..5b19892b 100644 --- a/src/main/java/com/squareup/square/AsyncRawRefundsClient.java +++ b/src/main/java/com/squareup/square/AsyncRawRefundsClient.java @@ -54,6 +54,17 @@ public CompletableFutureResults are eventually consistent, and new refunds or changes to refunds might take several + * seconds to appear.

+ *

The maximum results per page is 100.

+ */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListRefundsRequest.builder().build(), requestOptions); + } + /** * Retrieves a list of refunds for the account making the request. *

Results are eventually consistent, and new refunds or changes to refunds might take several diff --git a/src/main/java/com/squareup/square/AsyncRawSubscriptionsClient.java b/src/main/java/com/squareup/square/AsyncRawSubscriptionsClient.java index d43b19c2..eb59092f 100644 --- a/src/main/java/com/squareup/square/AsyncRawSubscriptionsClient.java +++ b/src/main/java/com/squareup/square/AsyncRawSubscriptionsClient.java @@ -220,6 +220,25 @@ public CompletableFuture> return search(SearchSubscriptionsRequest.builder().build()); } + /** + * Searches for subscriptions. + *

Results are ordered chronologically by subscription creation date. If + * the request specifies more than one location ID, + * the endpoint orders the result + * by location ID, and then by creation date within each location. If no locations are given + * in the query, all locations are searched.

+ *

You can also optionally specify customer_ids to search by customer. + * If left unset, all customers + * associated with the specified locations are returned. + * If the request specifies customer IDs, the endpoint orders results + * first by location, within location by customer ID, and within + * customer by subscription creation date.

+ */ + public CompletableFuture> search( + RequestOptions requestOptions) { + return search(SearchSubscriptionsRequest.builder().build(), requestOptions); + } + /** * Searches for subscriptions. *

Results are ordered chronologically by subscription creation date. If diff --git a/src/main/java/com/squareup/square/AsyncRawTeamClient.java b/src/main/java/com/squareup/square/AsyncRawTeamClient.java index ac794200..17cd6cb5 100644 --- a/src/main/java/com/squareup/square/AsyncRawTeamClient.java +++ b/src/main/java/com/squareup/square/AsyncRawTeamClient.java @@ -47,6 +47,13 @@ public CompletableFuture> listJobs() return listJobs(ListJobsRequest.builder().build()); } + /** + * Lists jobs in a seller account. Results are sorted by title in ascending order. + */ + public CompletableFuture> listJobs(RequestOptions requestOptions) { + return listJobs(ListJobsRequest.builder().build(), requestOptions); + } + /** * Lists jobs in a seller account. Results are sorted by title in ascending order. */ diff --git a/src/main/java/com/squareup/square/AsyncRawTeamMembersClient.java b/src/main/java/com/squareup/square/AsyncRawTeamMembersClient.java index ee010008..5dd4b1cf 100644 --- a/src/main/java/com/squareup/square/AsyncRawTeamMembersClient.java +++ b/src/main/java/com/squareup/square/AsyncRawTeamMembersClient.java @@ -56,6 +56,19 @@ public CompletableFuture> cre return create(CreateTeamMemberRequest.builder().build()); } + /** + * Creates a single TeamMember object. The TeamMember object is returned on successful creates. + * You must provide the following values in your request to this endpoint: + *

    + *
  • given_name
  • + *
  • family_name
  • + *
+ *

Learn about Troubleshooting the Team API.

+ */ + public CompletableFuture> create(RequestOptions requestOptions) { + return create(CreateTeamMemberRequest.builder().build(), requestOptions); + } + /** * Creates a single TeamMember object. The TeamMember object is returned on successful creates. * You must provide the following values in your request to this endpoint: @@ -287,6 +300,16 @@ public CompletableFuture> se return search(SearchTeamMembersRequest.builder().build()); } + /** + * Returns a paginated list of TeamMember objects for a business. + * The list can be filtered by location IDs, ACTIVE or INACTIVE status, or whether + * the team member is the Square account owner. + */ + public CompletableFuture> search( + RequestOptions requestOptions) { + return search(SearchTeamMembersRequest.builder().build(), requestOptions); + } + /** * Returns a paginated list of TeamMember objects for a business. * The list can be filtered by location IDs, ACTIVE or INACTIVE status, or whether diff --git a/src/main/java/com/squareup/square/AsyncRawTransferOrdersClient.java b/src/main/java/com/squareup/square/AsyncRawTransferOrdersClient.java index 467fc380..7a069cff 100644 --- a/src/main/java/com/squareup/square/AsyncRawTransferOrdersClient.java +++ b/src/main/java/com/squareup/square/AsyncRawTransferOrdersClient.java @@ -171,6 +171,21 @@ public CompletableFutureTransferOrders sorted by creation date. + *

Common search scenarios:

+ * + */ + public CompletableFuture>> search( + RequestOptions requestOptions) { + return search(SearchTransferOrdersRequest.builder().build(), requestOptions); + } + /** * Searches for transfer orders using filters. Returns a paginated list of matching * TransferOrders sorted by creation date. diff --git a/src/main/java/com/squareup/square/AsyncRawVendorsClient.java b/src/main/java/com/squareup/square/AsyncRawVendorsClient.java index 349d95d6..c662f46e 100644 --- a/src/main/java/com/squareup/square/AsyncRawVendorsClient.java +++ b/src/main/java/com/squareup/square/AsyncRawVendorsClient.java @@ -117,6 +117,14 @@ public CompletableFuture> batc return batchGet(BatchGetVendorsRequest.builder().build()); } + /** + * Retrieves one or more vendors of specified Vendor IDs. + */ + public CompletableFuture> batchGet( + RequestOptions requestOptions) { + return batchGet(BatchGetVendorsRequest.builder().build(), requestOptions); + } + /** * Retrieves one or more vendors of specified Vendor IDs. */ @@ -316,6 +324,13 @@ public CompletableFuture> search return search(SearchVendorsRequest.builder().build()); } + /** + * Searches for vendors using a filter against supported Vendor properties and a supported sorter. + */ + public CompletableFuture> search(RequestOptions requestOptions) { + return search(SearchVendorsRequest.builder().build(), requestOptions); + } + /** * Searches for vendors using a filter against supported Vendor properties and a supported sorter. */ diff --git a/src/main/java/com/squareup/square/AsyncRefundsClient.java b/src/main/java/com/squareup/square/AsyncRefundsClient.java index 3abc0206..efae16b9 100644 --- a/src/main/java/com/squareup/square/AsyncRefundsClient.java +++ b/src/main/java/com/squareup/square/AsyncRefundsClient.java @@ -41,6 +41,16 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + /** + * Retrieves a list of refunds for the account making the request. + *

Results are eventually consistent, and new refunds or changes to refunds might take several + * seconds to appear.

+ *

The maximum results per page is 100.

+ */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + /** * Retrieves a list of refunds for the account making the request. *

Results are eventually consistent, and new refunds or changes to refunds might take several diff --git a/src/main/java/com/squareup/square/AsyncSquareClient.java b/src/main/java/com/squareup/square/AsyncSquareClient.java index c78a23b4..32b618e7 100644 --- a/src/main/java/com/squareup/square/AsyncSquareClient.java +++ b/src/main/java/com/squareup/square/AsyncSquareClient.java @@ -12,8 +12,6 @@ public class AsyncSquareClient { protected final ClientOptions clientOptions; - protected final Supplier mobileClient; - protected final Supplier oAuthClient; protected final Supplier v1TransactionsClient; @@ -80,13 +78,14 @@ public class AsyncSquareClient { protected final Supplier vendorsClient; + protected final Supplier mobileClient; + protected final Supplier cashDrawersClient; protected final Supplier webhooksClient; public AsyncSquareClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; - this.mobileClient = Suppliers.memoize(() -> new AsyncMobileClient(clientOptions)); this.oAuthClient = Suppliers.memoize(() -> new AsyncOAuthClient(clientOptions)); this.v1TransactionsClient = Suppliers.memoize(() -> new AsyncV1TransactionsClient(clientOptions)); this.applePayClient = Suppliers.memoize(() -> new AsyncApplePayClient(clientOptions)); @@ -120,14 +119,11 @@ public AsyncSquareClient(ClientOptions clientOptions) { this.terminalClient = Suppliers.memoize(() -> new AsyncTerminalClient(clientOptions)); this.transferOrdersClient = Suppliers.memoize(() -> new AsyncTransferOrdersClient(clientOptions)); this.vendorsClient = Suppliers.memoize(() -> new AsyncVendorsClient(clientOptions)); + this.mobileClient = Suppliers.memoize(() -> new AsyncMobileClient(clientOptions)); this.cashDrawersClient = Suppliers.memoize(() -> new AsyncCashDrawersClient(clientOptions)); this.webhooksClient = Suppliers.memoize(() -> new AsyncWebhooksClient(clientOptions)); } - public AsyncMobileClient mobile() { - return this.mobileClient.get(); - } - public AsyncOAuthClient oAuth() { return this.oAuthClient.get(); } @@ -260,6 +256,10 @@ public AsyncVendorsClient vendors() { return this.vendorsClient.get(); } + public AsyncMobileClient mobile() { + return this.mobileClient.get(); + } + public AsyncCashDrawersClient cashDrawers() { return this.cashDrawersClient.get(); } diff --git a/src/main/java/com/squareup/square/AsyncSquareClientBuilder.java b/src/main/java/com/squareup/square/AsyncSquareClientBuilder.java index 2c0155a9..0bd04578 100644 --- a/src/main/java/com/squareup/square/AsyncSquareClientBuilder.java +++ b/src/main/java/com/squareup/square/AsyncSquareClientBuilder.java @@ -19,7 +19,7 @@ public class AsyncSquareClientBuilder { private String token = System.getenv("SQUARE_TOKEN"); - private String version = "2025-10-16"; + private String version = "2026-01-22"; private Environment environment = Environment.PRODUCTION; diff --git a/src/main/java/com/squareup/square/AsyncSubscriptionsClient.java b/src/main/java/com/squareup/square/AsyncSubscriptionsClient.java index fb4aa583..43db1a33 100644 --- a/src/main/java/com/squareup/square/AsyncSubscriptionsClient.java +++ b/src/main/java/com/squareup/square/AsyncSubscriptionsClient.java @@ -109,6 +109,24 @@ public CompletableFuture search() { return this.rawClient.search().thenApply(response -> response.body()); } + /** + * Searches for subscriptions. + *

Results are ordered chronologically by subscription creation date. If + * the request specifies more than one location ID, + * the endpoint orders the result + * by location ID, and then by creation date within each location. If no locations are given + * in the query, all locations are searched.

+ *

You can also optionally specify customer_ids to search by customer. + * If left unset, all customers + * associated with the specified locations are returned. + * If the request specifies customer IDs, the endpoint orders results + * first by location, within location by customer ID, and within + * customer by subscription creation date.

+ */ + public CompletableFuture search(RequestOptions requestOptions) { + return this.rawClient.search(requestOptions).thenApply(response -> response.body()); + } + /** * Searches for subscriptions. *

Results are ordered chronologically by subscription creation date. If diff --git a/src/main/java/com/squareup/square/AsyncTeamClient.java b/src/main/java/com/squareup/square/AsyncTeamClient.java index f087ca29..da9a9277 100644 --- a/src/main/java/com/squareup/square/AsyncTeamClient.java +++ b/src/main/java/com/squareup/square/AsyncTeamClient.java @@ -39,6 +39,13 @@ public CompletableFuture listJobs() { return this.rawClient.listJobs().thenApply(response -> response.body()); } + /** + * Lists jobs in a seller account. Results are sorted by title in ascending order. + */ + public CompletableFuture listJobs(RequestOptions requestOptions) { + return this.rawClient.listJobs(requestOptions).thenApply(response -> response.body()); + } + /** * Lists jobs in a seller account. Results are sorted by title in ascending order. */ diff --git a/src/main/java/com/squareup/square/AsyncTeamMembersClient.java b/src/main/java/com/squareup/square/AsyncTeamMembersClient.java index 0c09eeb5..92e0a351 100644 --- a/src/main/java/com/squareup/square/AsyncTeamMembersClient.java +++ b/src/main/java/com/squareup/square/AsyncTeamMembersClient.java @@ -55,6 +55,19 @@ public CompletableFuture create() { return this.rawClient.create().thenApply(response -> response.body()); } + /** + * Creates a single TeamMember object. The TeamMember object is returned on successful creates. + * You must provide the following values in your request to this endpoint: + *

    + *
  • given_name
  • + *
  • family_name
  • + *
+ *

Learn about Troubleshooting the Team API.

+ */ + public CompletableFuture create(RequestOptions requestOptions) { + return this.rawClient.create(requestOptions).thenApply(response -> response.body()); + } + /** * Creates a single TeamMember object. The TeamMember object is returned on successful creates. * You must provide the following values in your request to this endpoint: @@ -137,6 +150,15 @@ public CompletableFuture search() { return this.rawClient.search().thenApply(response -> response.body()); } + /** + * Returns a paginated list of TeamMember objects for a business. + * The list can be filtered by location IDs, ACTIVE or INACTIVE status, or whether + * the team member is the Square account owner. + */ + public CompletableFuture search(RequestOptions requestOptions) { + return this.rawClient.search(requestOptions).thenApply(response -> response.body()); + } + /** * Returns a paginated list of TeamMember objects for a business. * The list can be filtered by location IDs, ACTIVE or INACTIVE status, or whether diff --git a/src/main/java/com/squareup/square/AsyncTransferOrdersClient.java b/src/main/java/com/squareup/square/AsyncTransferOrdersClient.java index 356796b9..abeff934 100644 --- a/src/main/java/com/squareup/square/AsyncTransferOrdersClient.java +++ b/src/main/java/com/squareup/square/AsyncTransferOrdersClient.java @@ -108,6 +108,20 @@ public CompletableFuture> search() { return this.rawClient.search().thenApply(response -> response.body()); } + /** + * Searches for transfer orders using filters. Returns a paginated list of matching + * TransferOrders sorted by creation date. + *

Common search scenarios:

+ * + */ + public CompletableFuture> search(RequestOptions requestOptions) { + return this.rawClient.search(requestOptions).thenApply(response -> response.body()); + } + /** * Searches for transfer orders using filters. Returns a paginated list of matching * TransferOrders sorted by creation date. diff --git a/src/main/java/com/squareup/square/AsyncVendorsClient.java b/src/main/java/com/squareup/square/AsyncVendorsClient.java index 6d6f281a..6f789958 100644 --- a/src/main/java/com/squareup/square/AsyncVendorsClient.java +++ b/src/main/java/com/squareup/square/AsyncVendorsClient.java @@ -60,6 +60,13 @@ public CompletableFuture batchGet() { return this.rawClient.batchGet().thenApply(response -> response.body()); } + /** + * Retrieves one or more vendors of specified Vendor IDs. + */ + public CompletableFuture batchGet(RequestOptions requestOptions) { + return this.rawClient.batchGet(requestOptions).thenApply(response -> response.body()); + } + /** * Retrieves one or more vendors of specified Vendor IDs. */ @@ -111,6 +118,13 @@ public CompletableFuture search() { return this.rawClient.search().thenApply(response -> response.body()); } + /** + * Searches for vendors using a filter against supported Vendor properties and a supported sorter. + */ + public CompletableFuture search(RequestOptions requestOptions) { + return this.rawClient.search(requestOptions).thenApply(response -> response.body()); + } + /** * Searches for vendors using a filter against supported Vendor properties and a supported sorter. */ diff --git a/src/main/java/com/squareup/square/BankAccountsClient.java b/src/main/java/com/squareup/square/BankAccountsClient.java index 23cb3dda..e32a4911 100644 --- a/src/main/java/com/squareup/square/BankAccountsClient.java +++ b/src/main/java/com/squareup/square/BankAccountsClient.java @@ -7,6 +7,10 @@ import com.squareup.square.core.RequestOptions; import com.squareup.square.core.SyncPagingIterable; import com.squareup.square.types.BankAccount; +import com.squareup.square.types.CreateBankAccountRequest; +import com.squareup.square.types.CreateBankAccountResponse; +import com.squareup.square.types.DisableBankAccountRequest; +import com.squareup.square.types.DisableBankAccountResponse; import com.squareup.square.types.GetBankAccountByV1IdResponse; import com.squareup.square.types.GetBankAccountResponse; import com.squareup.square.types.GetBankAccountsRequest; @@ -37,6 +41,13 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + /** + * Returns a list of BankAccount objects linked to a Square account. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + /** * Returns a list of BankAccount objects linked to a Square account. */ @@ -51,6 +62,21 @@ public SyncPagingIterable list(ListBankAccountsRequest request, Req return this.rawClient.list(request, requestOptions).body(); } + /** + * Store a bank account on file for a square account + */ + public CreateBankAccountResponse createBankAccount(CreateBankAccountRequest request) { + return this.rawClient.createBankAccount(request).body(); + } + + /** + * Store a bank account on file for a square account + */ + public CreateBankAccountResponse createBankAccount( + CreateBankAccountRequest request, RequestOptions requestOptions) { + return this.rawClient.createBankAccount(request, requestOptions).body(); + } + /** * Returns details of a BankAccount identified by V1 bank account ID. */ @@ -66,18 +92,31 @@ public GetBankAccountByV1IdResponse getByV1Id(GetByV1IdBankAccountsRequest reque } /** - * Returns details of a BankAccount - * linked to a Square account. + * Retrieve details of a BankAccount bank account linked to a Square account. */ public GetBankAccountResponse get(GetBankAccountsRequest request) { return this.rawClient.get(request).body(); } /** - * Returns details of a BankAccount - * linked to a Square account. + * Retrieve details of a BankAccount bank account linked to a Square account. */ public GetBankAccountResponse get(GetBankAccountsRequest request, RequestOptions requestOptions) { return this.rawClient.get(request, requestOptions).body(); } + + /** + * Disable a bank account. + */ + public DisableBankAccountResponse disableBankAccount(DisableBankAccountRequest request) { + return this.rawClient.disableBankAccount(request).body(); + } + + /** + * Disable a bank account. + */ + public DisableBankAccountResponse disableBankAccount( + DisableBankAccountRequest request, RequestOptions requestOptions) { + return this.rawClient.disableBankAccount(request, requestOptions).body(); + } } diff --git a/src/main/java/com/squareup/square/BookingsClient.java b/src/main/java/com/squareup/square/BookingsClient.java index 862002f5..44f5edf4 100644 --- a/src/main/java/com/squareup/square/BookingsClient.java +++ b/src/main/java/com/squareup/square/BookingsClient.java @@ -71,6 +71,15 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + /** + * Retrieve a collection of bookings. + *

To call this endpoint with buyer-level permissions, set APPOINTMENTS_READ for the OAuth scope. + * To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_READ and APPOINTMENTS_READ for the OAuth scope.

+ */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + /** * Retrieve a collection of bookings. *

To call this endpoint with buyer-level permissions, set APPOINTMENTS_READ for the OAuth scope. diff --git a/src/main/java/com/squareup/square/CardsClient.java b/src/main/java/com/squareup/square/CardsClient.java index 44653d26..3124d14e 100644 --- a/src/main/java/com/squareup/square/CardsClient.java +++ b/src/main/java/com/squareup/square/CardsClient.java @@ -40,6 +40,14 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + /** + * Retrieves a list of cards owned by the account making the request. + * A max of 25 cards will be returned. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + /** * Retrieves a list of cards owned by the account making the request. * A max of 25 cards will be returned. diff --git a/src/main/java/com/squareup/square/CatalogClient.java b/src/main/java/com/squareup/square/CatalogClient.java index 1be6dec3..bc24c0bf 100644 --- a/src/main/java/com/squareup/square/CatalogClient.java +++ b/src/main/java/com/squareup/square/CatalogClient.java @@ -178,6 +178,18 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + /** + * Returns a list of all CatalogObjects of the specified types in the catalog. + *

The types parameter is specified as a comma-separated list of the CatalogObjectType values, + * for example, "ITEM, ITEM_VARIATION, MODIFIER, MODIFIER_LIST, CATEGORY, DISCOUNT, TAX, IMAGE".

+ *

Important: ListCatalog does not return deleted catalog items. To retrieve + * deleted catalog items, use SearchCatalogObjects + * and set the include_deleted_objects attribute value to true.

+ */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + /** * Returns a list of all CatalogObjects of the specified types in the catalog. *

The types parameter is specified as a comma-separated list of the CatalogObjectType values, @@ -218,6 +230,22 @@ public SearchCatalogObjectsResponse search() { return this.rawClient.search().body(); } + /** + * Searches for CatalogObject of any type by matching supported search attribute values, + * excluding custom attribute values on items or item variations, against one or more of the specified query filters. + *

This (SearchCatalogObjects) endpoint differs from the SearchCatalogItems + * endpoint in the following aspects:

+ *
    + *
  • SearchCatalogItems can only search for items or item variations, whereas SearchCatalogObjects can search for any type of catalog objects.
  • + *
  • SearchCatalogItems supports the custom attribute query filters to return items or item variations that contain custom attribute values, where SearchCatalogObjects does not.
  • + *
  • SearchCatalogItems does not support the include_deleted_objects filter to search for deleted items or item variations, whereas SearchCatalogObjects does.
  • + *
  • The both endpoints have different call conventions, including the query filter formats.
  • + *
+ */ + public SearchCatalogObjectsResponse search(RequestOptions requestOptions) { + return this.rawClient.search(requestOptions).body(); + } + /** * Searches for CatalogObject of any type by matching supported search attribute values, * excluding custom attribute values on items or item variations, against one or more of the specified query filters. @@ -266,6 +294,22 @@ public SearchCatalogItemsResponse searchItems() { return this.rawClient.searchItems().body(); } + /** + * Searches for catalog items or item variations by matching supported search attribute values, including + * custom attribute values, against one or more of the specified query filters. + *

This (SearchCatalogItems) endpoint differs from the SearchCatalogObjects + * endpoint in the following aspects:

+ *
    + *
  • SearchCatalogItems can only search for items or item variations, whereas SearchCatalogObjects can search for any type of catalog objects.
  • + *
  • SearchCatalogItems supports the custom attribute query filters to return items or item variations that contain custom attribute values, where SearchCatalogObjects does not.
  • + *
  • SearchCatalogItems does not support the include_deleted_objects filter to search for deleted items or item variations, whereas SearchCatalogObjects does.
  • + *
  • The both endpoints use different call conventions, including the query filter formats.
  • + *
+ */ + public SearchCatalogItemsResponse searchItems(RequestOptions requestOptions) { + return this.rawClient.searchItems(requestOptions).body(); + } + /** * Searches for catalog items or item variations by matching supported search attribute values, including * custom attribute values, against one or more of the specified query filters. diff --git a/src/main/java/com/squareup/square/ChannelsClient.java b/src/main/java/com/squareup/square/ChannelsClient.java index 0d74ed7c..2f6362b7 100644 --- a/src/main/java/com/squareup/square/ChannelsClient.java +++ b/src/main/java/com/squareup/square/ChannelsClient.java @@ -34,6 +34,10 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + public SyncPagingIterable list(ListChannelsRequest request) { return this.rawClient.list(request).body(); } diff --git a/src/main/java/com/squareup/square/CustomersClient.java b/src/main/java/com/squareup/square/CustomersClient.java index e714cdd4..90b49d34 100644 --- a/src/main/java/com/squareup/square/CustomersClient.java +++ b/src/main/java/com/squareup/square/CustomersClient.java @@ -77,6 +77,16 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + /** + * Lists customer profiles associated with a Square account. + *

Under normal operating conditions, newly created or updated customer profiles become available + * for the listing operation in well under 30 seconds. Occasionally, propagation of the new or updated + * profiles can take closer to one minute or longer, especially during network incidents and outages.

+ */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + /** * Lists customer profiles associated with a Square account. *

Under normal operating conditions, newly created or updated customer profiles become available @@ -113,6 +123,22 @@ public CreateCustomerResponse create() { return this.rawClient.create().body(); } + /** + * Creates a new customer for a business. + *

You must provide at least one of the following values in your request to this + * endpoint:

+ *
    + *
  • given_name
  • + *
  • family_name
  • + *
  • company_name
  • + *
  • email_address
  • + *
  • phone_number
  • + *
+ */ + public CreateCustomerResponse create(RequestOptions requestOptions) { + return this.rawClient.create(requestOptions).body(); + } + /** * Creates a new customer for a business. *

You must provide at least one of the following values in your request to this @@ -241,6 +267,19 @@ public SearchCustomersResponse search() { return this.rawClient.search().body(); } + /** + * Searches the customer profiles associated with a Square account using one or more supported query filters. + *

Calling SearchCustomers without any explicit query filter returns all + * customer profiles ordered alphabetically based on given_name and + * family_name.

+ *

Under normal operating conditions, newly created or updated customer profiles become available + * for the search operation in well under 30 seconds. Occasionally, propagation of the new or updated + * profiles can take closer to one minute or longer, especially during network incidents and outages.

+ */ + public SearchCustomersResponse search(RequestOptions requestOptions) { + return this.rawClient.search(requestOptions).body(); + } + /** * Searches the customer profiles associated with a Square account using one or more supported query filters. *

Calling SearchCustomers without any explicit query filter returns all diff --git a/src/main/java/com/squareup/square/DevicesClient.java b/src/main/java/com/squareup/square/DevicesClient.java index 3d996e73..4d71db1b 100644 --- a/src/main/java/com/squareup/square/DevicesClient.java +++ b/src/main/java/com/squareup/square/DevicesClient.java @@ -42,6 +42,14 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + /** + * List devices associated with the merchant. Currently, only Terminal API + * devices are supported. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + /** * List devices associated with the merchant. Currently, only Terminal API * devices are supported. diff --git a/src/main/java/com/squareup/square/DisputesClient.java b/src/main/java/com/squareup/square/DisputesClient.java index 81cf2821..c5b83c14 100644 --- a/src/main/java/com/squareup/square/DisputesClient.java +++ b/src/main/java/com/squareup/square/DisputesClient.java @@ -49,6 +49,13 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + /** + * Returns a list of disputes associated with a particular account. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + /** * Returns a list of disputes associated with a particular account. */ diff --git a/src/main/java/com/squareup/square/EmployeesClient.java b/src/main/java/com/squareup/square/EmployeesClient.java index 5cdc8257..900b226d 100644 --- a/src/main/java/com/squareup/square/EmployeesClient.java +++ b/src/main/java/com/squareup/square/EmployeesClient.java @@ -32,6 +32,10 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + public SyncPagingIterable list(ListEmployeesRequest request) { return this.rawClient.list(request).body(); } diff --git a/src/main/java/com/squareup/square/EventsClient.java b/src/main/java/com/squareup/square/EventsClient.java index 8b00d6d8..43d4df50 100644 --- a/src/main/java/com/squareup/square/EventsClient.java +++ b/src/main/java/com/squareup/square/EventsClient.java @@ -36,6 +36,13 @@ public SearchEventsResponse searchEvents() { return this.rawClient.searchEvents().body(); } + /** + * Search for Square API events that occur within a 28-day timeframe. + */ + public SearchEventsResponse searchEvents(RequestOptions requestOptions) { + return this.rawClient.searchEvents(requestOptions).body(); + } + /** * Search for Square API events that occur within a 28-day timeframe. */ @@ -89,6 +96,13 @@ public ListEventTypesResponse listEventTypes() { return this.rawClient.listEventTypes().body(); } + /** + * Lists all event types that you can subscribe to as webhooks or query using the Events API. + */ + public ListEventTypesResponse listEventTypes(RequestOptions requestOptions) { + return this.rawClient.listEventTypes(requestOptions).body(); + } + /** * Lists all event types that you can subscribe to as webhooks or query using the Events API. */ diff --git a/src/main/java/com/squareup/square/GiftCardsClient.java b/src/main/java/com/squareup/square/GiftCardsClient.java index 4b040cc7..f1ebdfa8 100644 --- a/src/main/java/com/squareup/square/GiftCardsClient.java +++ b/src/main/java/com/squareup/square/GiftCardsClient.java @@ -52,6 +52,14 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + /** + * Lists all gift cards. You can specify optional filters to retrieve + * a subset of the gift cards. Results are sorted by created_at in ascending order. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + /** * Lists all gift cards. You can specify optional filters to retrieve * a subset of the gift cards. Results are sorted by created_at in ascending order. diff --git a/src/main/java/com/squareup/square/InventoryClient.java b/src/main/java/com/squareup/square/InventoryClient.java index c7ff71c6..c5619180 100644 --- a/src/main/java/com/squareup/square/InventoryClient.java +++ b/src/main/java/com/squareup/square/InventoryClient.java @@ -101,6 +101,14 @@ public BatchGetInventoryChangesResponse deprecatedBatchGetChanges() { return this.rawClient.deprecatedBatchGetChanges().body(); } + /** + * Deprecated version of BatchRetrieveInventoryChanges after the endpoint URL + * is updated to conform to the standard convention. + */ + public BatchGetInventoryChangesResponse deprecatedBatchGetChanges(RequestOptions requestOptions) { + return this.rawClient.deprecatedBatchGetChanges(requestOptions).body(); + } + /** * Deprecated version of BatchRetrieveInventoryChanges after the endpoint URL * is updated to conform to the standard convention. @@ -126,6 +134,14 @@ public BatchGetInventoryCountsResponse deprecatedBatchGetCounts() { return this.rawClient.deprecatedBatchGetCounts().body(); } + /** + * Deprecated version of BatchRetrieveInventoryCounts after the endpoint URL + * is updated to conform to the standard convention. + */ + public BatchGetInventoryCountsResponse deprecatedBatchGetCounts(RequestOptions requestOptions) { + return this.rawClient.deprecatedBatchGetCounts(requestOptions).body(); + } + /** * Deprecated version of BatchRetrieveInventoryCounts after the endpoint URL * is updated to conform to the standard convention. @@ -176,6 +192,18 @@ public SyncPagingIterable batchGetChanges() { return this.rawClient.batchGetChanges().body(); } + /** + * Returns historical physical counts and adjustments based on the + * provided filter criteria. + *

Results are paginated and sorted in ascending order according their + * occurred_at timestamp (oldest first).

+ *

BatchRetrieveInventoryChanges is a catch-all query endpoint for queries + * that cannot be handled by other, simpler endpoints.

+ */ + public SyncPagingIterable batchGetChanges(RequestOptions requestOptions) { + return this.rawClient.batchGetChanges(requestOptions).body(); + } + /** * Returns historical physical counts and adjustments based on the * provided filter criteria. @@ -216,6 +244,21 @@ public SyncPagingIterable batchGetCounts() { return this.rawClient.batchGetCounts().body(); } + /** + * Returns current counts for the provided + * CatalogObjects at the requested + * Locations. + *

Results are paginated and sorted in descending order according to their + * calculated_at timestamp (newest first).

+ *

When updated_after is specified, only counts that have changed since that + * time (based on the server timestamp for the most recent change) are + * returned. This allows clients to perform a "sync" operation, for example + * in response to receiving a Webhook notification.

+ */ + public SyncPagingIterable batchGetCounts(RequestOptions requestOptions) { + return this.rawClient.batchGetCounts(requestOptions).body(); + } + /** * Returns current counts for the provided * CatalogObjects at the requested diff --git a/src/main/java/com/squareup/square/LaborClient.java b/src/main/java/com/squareup/square/LaborClient.java index d3d6a2d5..ab6daa1d 100644 --- a/src/main/java/com/squareup/square/LaborClient.java +++ b/src/main/java/com/squareup/square/LaborClient.java @@ -131,6 +131,14 @@ public SearchScheduledShiftsResponse searchScheduledShifts() { return this.rawClient.searchScheduledShifts().body(); } + /** + * Returns a paginated list of scheduled shifts, with optional filter and sort settings. + * By default, results are sorted by start_at in ascending order. + */ + public SearchScheduledShiftsResponse searchScheduledShifts(RequestOptions requestOptions) { + return this.rawClient.searchScheduledShifts(requestOptions).body(); + } + /** * Returns a paginated list of scheduled shifts, with optional filter and sort settings. * By default, results are sorted by start_at in ascending order. @@ -288,6 +296,29 @@ public SearchTimecardsResponse searchTimecards() { return this.rawClient.searchTimecards().body(); } + /** + * Returns a paginated list of Timecard records for a business. + * The list to be returned can be filtered by: + *
    + *
  • Location IDs
  • + *
  • Team member IDs
  • + *
  • Timecard status (OPEN or CLOSED)
  • + *
  • Timecard start
  • + *
  • Timecard end
  • + *
  • Workday details
  • + *
+ *

The list can be sorted by:

+ *
    + *
  • START_AT
  • + *
  • END_AT
  • + *
  • CREATED_AT
  • + *
  • UPDATED_AT
  • + *
+ */ + public SearchTimecardsResponse searchTimecards(RequestOptions requestOptions) { + return this.rawClient.searchTimecards(requestOptions).body(); + } + /** * Returns a paginated list of Timecard records for a business. * The list to be returned can be filtered by: diff --git a/src/main/java/com/squareup/square/LocationsClient.java b/src/main/java/com/squareup/square/LocationsClient.java index a0d75735..a970824f 100644 --- a/src/main/java/com/squareup/square/LocationsClient.java +++ b/src/main/java/com/squareup/square/LocationsClient.java @@ -76,6 +76,19 @@ public CreateLocationResponse create() { return this.rawClient.create().body(); } + /** + * Creates a location. + * Creating new locations allows for separate configuration of receipt layouts, item prices, + * and sales reports. Developers can use locations to separate sales activity through applications + * that integrate with Square from sales activity elsewhere in a seller's account. + * Locations created programmatically with the Locations API last forever and + * are visible to the seller for their own management. Therefore, ensure that + * each location has a sensible and unique name. + */ + public CreateLocationResponse create(RequestOptions requestOptions) { + return this.rawClient.create(requestOptions).body(); + } + /** * Creates a location. * Creating new locations allows for separate configuration of receipt layouts, item prices, diff --git a/src/main/java/com/squareup/square/LoyaltyClient.java b/src/main/java/com/squareup/square/LoyaltyClient.java index 430835f3..b53c9b34 100644 --- a/src/main/java/com/squareup/square/LoyaltyClient.java +++ b/src/main/java/com/squareup/square/LoyaltyClient.java @@ -51,6 +51,18 @@ public SearchLoyaltyEventsResponse searchEvents() { return this.rawClient.searchEvents().body(); } + /** + * Searches for loyalty events. + *

A Square loyalty program maintains a ledger of events that occur during the lifetime of a + * buyer's loyalty account. Each change in the point balance + * (for example, points earned, points redeemed, and points expired) is + * recorded in the ledger. Using this endpoint, you can search the ledger for events.

+ *

Search results are sorted by created_at in descending order.

+ */ + public SearchLoyaltyEventsResponse searchEvents(RequestOptions requestOptions) { + return this.rawClient.searchEvents(requestOptions).body(); + } + /** * Searches for loyalty events. *

A Square loyalty program maintains a ledger of events that occur during the lifetime of a diff --git a/src/main/java/com/squareup/square/MerchantsClient.java b/src/main/java/com/squareup/square/MerchantsClient.java index a2dd98d8..8d83641d 100644 --- a/src/main/java/com/squareup/square/MerchantsClient.java +++ b/src/main/java/com/squareup/square/MerchantsClient.java @@ -53,6 +53,20 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + /** + * Provides details about the merchant associated with a given access token. + *

The access token used to connect your application to a Square seller is associated + * with a single merchant. That means that ListMerchants returns a list + * with a single Merchant object. You can specify your personal access token + * to get your own merchant information or specify an OAuth token to get the + * information for the merchant that granted your application access.

+ *

If you know the merchant ID, you can also use the RetrieveMerchant + * endpoint to retrieve the merchant information.

+ */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + /** * Provides details about the merchant associated with a given access token. *

The access token used to connect your application to a Square seller is associated diff --git a/src/main/java/com/squareup/square/MobileClient.java b/src/main/java/com/squareup/square/MobileClient.java index 8c6378bd..a319dcc3 100644 --- a/src/main/java/com/squareup/square/MobileClient.java +++ b/src/main/java/com/squareup/square/MobileClient.java @@ -5,8 +5,6 @@ import com.squareup.square.core.ClientOptions; import com.squareup.square.core.RequestOptions; -import com.squareup.square.types.CreateMobileAuthorizationCodeRequest; -import com.squareup.square.types.CreateMobileAuthorizationCodeResponse; public class MobileClient { protected final ClientOptions clientOptions; @@ -25,49 +23,11 @@ public RawMobileClient withRawResponse() { return this.rawClient; } - /** - * Note: This endpoint is used by the deprecated Reader SDK. - * Developers should update their integration to use the Mobile Payments SDK, which includes its own authorization methods. - *

Generates code to authorize a mobile application to connect to a Square card reader.

- *

Authorization codes are one-time-use codes and expire 60 minutes after being issued.

- *

The Authorization header you provide to this endpoint must have the following format:

- *
Authorization: Bearer ACCESS_TOKEN
-     * 
- *

Replace ACCESS_TOKEN with a - * valid production authorization credential.

- */ - public CreateMobileAuthorizationCodeResponse authorizationCode() { - return this.rawClient.authorizationCode().body(); - } - - /** - * Note: This endpoint is used by the deprecated Reader SDK. - * Developers should update their integration to use the Mobile Payments SDK, which includes its own authorization methods. - *

Generates code to authorize a mobile application to connect to a Square card reader.

- *

Authorization codes are one-time-use codes and expire 60 minutes after being issued.

- *

The Authorization header you provide to this endpoint must have the following format:

- *
Authorization: Bearer ACCESS_TOKEN
-     * 
- *

Replace ACCESS_TOKEN with a - * valid production authorization credential.

- */ - public CreateMobileAuthorizationCodeResponse authorizationCode(CreateMobileAuthorizationCodeRequest request) { - return this.rawClient.authorizationCode(request).body(); + public void authorizationCode() { + this.rawClient.authorizationCode().body(); } - /** - * Note: This endpoint is used by the deprecated Reader SDK. - * Developers should update their integration to use the Mobile Payments SDK, which includes its own authorization methods. - *

Generates code to authorize a mobile application to connect to a Square card reader.

- *

Authorization codes are one-time-use codes and expire 60 minutes after being issued.

- *

The Authorization header you provide to this endpoint must have the following format:

- *
Authorization: Bearer ACCESS_TOKEN
-     * 
- *

Replace ACCESS_TOKEN with a - * valid production authorization credential.

- */ - public CreateMobileAuthorizationCodeResponse authorizationCode( - CreateMobileAuthorizationCodeRequest request, RequestOptions requestOptions) { - return this.rawClient.authorizationCode(request, requestOptions).body(); + public void authorizationCode(RequestOptions requestOptions) { + this.rawClient.authorizationCode(requestOptions).body(); } } diff --git a/src/main/java/com/squareup/square/OAuthClient.java b/src/main/java/com/squareup/square/OAuthClient.java index efa15128..116f8fa6 100644 --- a/src/main/java/com/squareup/square/OAuthClient.java +++ b/src/main/java/com/squareup/square/OAuthClient.java @@ -43,6 +43,21 @@ public RevokeTokenResponse revokeToken() { return this.rawClient.revokeToken().body(); } + /** + * Revokes an access token generated with the OAuth flow. + *

If an account has more than one OAuth access token for your application, this + * endpoint revokes all of them, regardless of which token you specify.

+ *

Important: The Authorization header for this endpoint must have the + * following format:

+ *
Authorization: Client APPLICATION_SECRET
+     * 
+ *

Replace APPLICATION_SECRET with the application secret on the OAuth + * page for your application in the Developer Dashboard.

+ */ + public RevokeTokenResponse revokeToken(RequestOptions requestOptions) { + return this.rawClient.revokeToken(requestOptions).body(); + } + /** * Revokes an access token generated with the OAuth flow. *

If an account has more than one OAuth access token for your application, this diff --git a/src/main/java/com/squareup/square/OrdersClient.java b/src/main/java/com/squareup/square/OrdersClient.java index a0310b5d..04b3ac15 100644 --- a/src/main/java/com/squareup/square/OrdersClient.java +++ b/src/main/java/com/squareup/square/OrdersClient.java @@ -61,6 +61,17 @@ public CreateOrderResponse create() { return this.rawClient.create().body(); } + /** + * Creates a new order that can include information about products for + * purchase and settings to apply to the purchase. + *

To pay for a created order, see + * Pay for Orders.

+ *

You can modify open orders using the UpdateOrder endpoint.

+ */ + public CreateOrderResponse create(RequestOptions requestOptions) { + return this.rawClient.create(requestOptions).body(); + } + /** * Creates a new order that can include information about products for * purchase and settings to apply to the purchase. @@ -149,6 +160,26 @@ public SearchOrdersResponse search() { return this.rawClient.search().body(); } + /** + * Search all orders for one or more locations. Orders include all sales, + * returns, and exchanges regardless of how or when they entered the Square + * ecosystem (such as Point of Sale, Invoices, and Connect APIs). + *

SearchOrders requests need to specify which locations to search and define a + * SearchOrdersQuery object that controls + * how to sort or filter the results. Your SearchOrdersQuery can:

+ *

Set filter criteria. + * Set the sort order. + * Determine whether to return results as complete Order objects or as + * OrderEntry objects.

+ *

Note that details for orders processed with Square Point of Sale while in + * offline mode might not be transmitted to Square for up to 72 hours. Offline + * orders have a created_at value that reflects the time the order was created, + * not the time it was subsequently transmitted to Square.

+ */ + public SearchOrdersResponse search(RequestOptions requestOptions) { + return this.rawClient.search(requestOptions).body(); + } + /** * Search all orders for one or more locations. Orders include all sales, * returns, and exchanges regardless of how or when they entered the Square diff --git a/src/main/java/com/squareup/square/PaymentsClient.java b/src/main/java/com/squareup/square/PaymentsClient.java index 6d905270..66ccc358 100644 --- a/src/main/java/com/squareup/square/PaymentsClient.java +++ b/src/main/java/com/squareup/square/PaymentsClient.java @@ -48,6 +48,16 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + /** + * Retrieves a list of payments taken by the account making the request. + *

Results are eventually consistent, and new payments or changes to payments might take several + * seconds to appear.

+ *

The maximum results per page is 100.

+ */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + /** * Retrieves a list of payments taken by the account making the request. *

Results are eventually consistent, and new payments or changes to payments might take several diff --git a/src/main/java/com/squareup/square/PayoutsClient.java b/src/main/java/com/squareup/square/PayoutsClient.java index 831ae0fb..8e2a8d1e 100644 --- a/src/main/java/com/squareup/square/PayoutsClient.java +++ b/src/main/java/com/squareup/square/PayoutsClient.java @@ -39,6 +39,15 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + /** + * Retrieves a list of all payouts for the default location. + * You can filter payouts by location ID, status, time range, and order them in ascending or descending order. + * To call this endpoint, set PAYOUTS_READ for the OAuth scope. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + /** * Retrieves a list of all payouts for the default location. * You can filter payouts by location ID, status, time range, and order them in ascending or descending order. diff --git a/src/main/java/com/squareup/square/RawBankAccountsClient.java b/src/main/java/com/squareup/square/RawBankAccountsClient.java index 8e79642c..6b58a9db 100644 --- a/src/main/java/com/squareup/square/RawBankAccountsClient.java +++ b/src/main/java/com/squareup/square/RawBankAccountsClient.java @@ -3,7 +3,9 @@ */ package com.squareup.square; +import com.fasterxml.jackson.core.JsonProcessingException; import com.squareup.square.core.ClientOptions; +import com.squareup.square.core.MediaTypes; import com.squareup.square.core.ObjectMappers; import com.squareup.square.core.QueryStringMapper; import com.squareup.square.core.RequestOptions; @@ -12,6 +14,10 @@ import com.squareup.square.core.SquareException; import com.squareup.square.core.SyncPagingIterable; import com.squareup.square.types.BankAccount; +import com.squareup.square.types.CreateBankAccountRequest; +import com.squareup.square.types.CreateBankAccountResponse; +import com.squareup.square.types.DisableBankAccountRequest; +import com.squareup.square.types.DisableBankAccountResponse; import com.squareup.square.types.GetBankAccountByV1IdResponse; import com.squareup.square.types.GetBankAccountResponse; import com.squareup.square.types.GetBankAccountsRequest; @@ -26,6 +32,7 @@ import okhttp3.HttpUrl; import okhttp3.OkHttpClient; import okhttp3.Request; +import okhttp3.RequestBody; import okhttp3.Response; import okhttp3.ResponseBody; @@ -43,6 +50,13 @@ public SquareClientHttpResponse> list() { return list(ListBankAccountsRequest.builder().build()); } + /** + * Returns a list of BankAccount objects linked to a Square account. + */ + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListBankAccountsRequest.builder().build(), requestOptions); + } + /** * Returns a list of BankAccount objects linked to a Square account. */ @@ -70,6 +84,10 @@ public SquareClientHttpResponse> list( QueryStringMapper.addQueryParameter( httpUrl, "location_id", request.getLocationId().get(), false); } + if (request.getCustomerId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "customer_id", request.getCustomerId().get(), false); + } Request.Builder _requestBuilder = new Request.Builder() .url(httpUrl.build()) .method("GET", null) @@ -107,6 +125,56 @@ public SquareClientHttpResponse> list( } } + /** + * Store a bank account on file for a square account + */ + public SquareClientHttpResponse createBankAccount(CreateBankAccountRequest request) { + return createBankAccount(request, null); + } + + /** + * Store a bank account on file for a square account + */ + public SquareClientHttpResponse createBankAccount( + CreateBankAccountRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v2/bank-accounts") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new SquareException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new SquareClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateBankAccountResponse.class), + response); + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new SquareApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new SquareException("Network error executing HTTP request", e); + } + } + /** * Returns details of a BankAccount identified by V1 bank account ID. */ @@ -151,16 +219,14 @@ public SquareClientHttpResponse getByV1Id( } /** - * Returns details of a BankAccount - * linked to a Square account. + * Retrieve details of a BankAccount bank account linked to a Square account. */ public SquareClientHttpResponse get(GetBankAccountsRequest request) { return get(request, null); } /** - * Returns details of a BankAccount - * linked to a Square account. + * Retrieve details of a BankAccount bank account linked to a Square account. */ public SquareClientHttpResponse get( GetBankAccountsRequest request, RequestOptions requestOptions) { @@ -194,4 +260,48 @@ public SquareClientHttpResponse get( throw new SquareException("Network error executing HTTP request", e); } } + + /** + * Disable a bank account. + */ + public SquareClientHttpResponse disableBankAccount(DisableBankAccountRequest request) { + return disableBankAccount(request, null); + } + + /** + * Disable a bank account. + */ + public SquareClientHttpResponse disableBankAccount( + DisableBankAccountRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v2/bank-accounts") + .addPathSegment(request.getBankAccountId()) + .addPathSegments("disable") + .build(); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new SquareClientHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DisableBankAccountResponse.class), + response); + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new SquareApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new SquareException("Network error executing HTTP request", e); + } + } } diff --git a/src/main/java/com/squareup/square/RawBookingsClient.java b/src/main/java/com/squareup/square/RawBookingsClient.java index c02a19d7..bd2065f8 100644 --- a/src/main/java/com/squareup/square/RawBookingsClient.java +++ b/src/main/java/com/squareup/square/RawBookingsClient.java @@ -61,6 +61,15 @@ public SquareClientHttpResponse> list() { return list(ListBookingsRequest.builder().build()); } + /** + * Retrieve a collection of bookings. + *

To call this endpoint with buyer-level permissions, set APPOINTMENTS_READ for the OAuth scope. + * To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_READ and APPOINTMENTS_READ for the OAuth scope.

+ */ + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListBookingsRequest.builder().build(), requestOptions); + } + /** * Retrieve a collection of bookings. *

To call this endpoint with buyer-level permissions, set APPOINTMENTS_READ for the OAuth scope. diff --git a/src/main/java/com/squareup/square/RawCardsClient.java b/src/main/java/com/squareup/square/RawCardsClient.java index d5c28c01..1649c3e7 100644 --- a/src/main/java/com/squareup/square/RawCardsClient.java +++ b/src/main/java/com/squareup/square/RawCardsClient.java @@ -49,6 +49,14 @@ public SquareClientHttpResponse> list() { return list(ListCardsRequest.builder().build()); } + /** + * Retrieves a list of cards owned by the account making the request. + * A max of 25 cards will be returned. + */ + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListCardsRequest.builder().build(), requestOptions); + } + /** * Retrieves a list of cards owned by the account making the request. * A max of 25 cards will be returned. diff --git a/src/main/java/com/squareup/square/RawCatalogClient.java b/src/main/java/com/squareup/square/RawCatalogClient.java index 9fdd259f..b039d54a 100644 --- a/src/main/java/com/squareup/square/RawCatalogClient.java +++ b/src/main/java/com/squareup/square/RawCatalogClient.java @@ -312,6 +312,18 @@ public SquareClientHttpResponse> list() { return list(ListCatalogRequest.builder().build()); } + /** + * Returns a list of all CatalogObjects of the specified types in the catalog. + *

The types parameter is specified as a comma-separated list of the CatalogObjectType values, + * for example, "ITEM, ITEM_VARIATION, MODIFIER, MODIFIER_LIST, CATEGORY, DISCOUNT, TAX, IMAGE".

+ *

Important: ListCatalog does not return deleted catalog items. To retrieve + * deleted catalog items, use SearchCatalogObjects + * and set the include_deleted_objects attribute value to true.

+ */ + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListCatalogRequest.builder().build(), requestOptions); + } + /** * Returns a list of all CatalogObjects of the specified types in the catalog. *

The types parameter is specified as a comma-separated list of the CatalogObjectType values, @@ -402,6 +414,22 @@ public SquareClientHttpResponse search() { return search(SearchCatalogObjectsRequest.builder().build()); } + /** + * Searches for CatalogObject of any type by matching supported search attribute values, + * excluding custom attribute values on items or item variations, against one or more of the specified query filters. + *

This (SearchCatalogObjects) endpoint differs from the SearchCatalogItems + * endpoint in the following aspects:

+ *
    + *
  • SearchCatalogItems can only search for items or item variations, whereas SearchCatalogObjects can search for any type of catalog objects.
  • + *
  • SearchCatalogItems supports the custom attribute query filters to return items or item variations that contain custom attribute values, where SearchCatalogObjects does not.
  • + *
  • SearchCatalogItems does not support the include_deleted_objects filter to search for deleted items or item variations, whereas SearchCatalogObjects does.
  • + *
  • The both endpoints have different call conventions, including the query filter formats.
  • + *
+ */ + public SquareClientHttpResponse search(RequestOptions requestOptions) { + return search(SearchCatalogObjectsRequest.builder().build(), requestOptions); + } + /** * Searches for CatalogObject of any type by matching supported search attribute values, * excluding custom attribute values on items or item variations, against one or more of the specified query filters. @@ -486,6 +514,22 @@ public SquareClientHttpResponse searchItems() { return searchItems(SearchCatalogItemsRequest.builder().build()); } + /** + * Searches for catalog items or item variations by matching supported search attribute values, including + * custom attribute values, against one or more of the specified query filters. + *

This (SearchCatalogItems) endpoint differs from the SearchCatalogObjects + * endpoint in the following aspects:

+ *
    + *
  • SearchCatalogItems can only search for items or item variations, whereas SearchCatalogObjects can search for any type of catalog objects.
  • + *
  • SearchCatalogItems supports the custom attribute query filters to return items or item variations that contain custom attribute values, where SearchCatalogObjects does not.
  • + *
  • SearchCatalogItems does not support the include_deleted_objects filter to search for deleted items or item variations, whereas SearchCatalogObjects does.
  • + *
  • The both endpoints use different call conventions, including the query filter formats.
  • + *
+ */ + public SquareClientHttpResponse searchItems(RequestOptions requestOptions) { + return searchItems(SearchCatalogItemsRequest.builder().build(), requestOptions); + } + /** * Searches for catalog items or item variations by matching supported search attribute values, including * custom attribute values, against one or more of the specified query filters. diff --git a/src/main/java/com/squareup/square/RawChannelsClient.java b/src/main/java/com/squareup/square/RawChannelsClient.java index f30fe1a7..1e851073 100644 --- a/src/main/java/com/squareup/square/RawChannelsClient.java +++ b/src/main/java/com/squareup/square/RawChannelsClient.java @@ -43,6 +43,10 @@ public SquareClientHttpResponse> list() { return list(ListChannelsRequest.builder().build()); } + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListChannelsRequest.builder().build(), requestOptions); + } + public SquareClientHttpResponse> list(ListChannelsRequest request) { return list(request, null); } diff --git a/src/main/java/com/squareup/square/RawCustomersClient.java b/src/main/java/com/squareup/square/RawCustomersClient.java index 39ab3d55..c50a652e 100644 --- a/src/main/java/com/squareup/square/RawCustomersClient.java +++ b/src/main/java/com/squareup/square/RawCustomersClient.java @@ -63,6 +63,16 @@ public SquareClientHttpResponse> list() { return list(ListCustomersRequest.builder().build()); } + /** + * Lists customer profiles associated with a Square account. + *

Under normal operating conditions, newly created or updated customer profiles become available + * for the listing operation in well under 30 seconds. Occasionally, propagation of the new or updated + * profiles can take closer to one minute or longer, especially during network incidents and outages.

+ */ + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListCustomersRequest.builder().build(), requestOptions); + } + /** * Lists customer profiles associated with a Square account. *

Under normal operating conditions, newly created or updated customer profiles become available @@ -156,6 +166,22 @@ public SquareClientHttpResponse create() { return create(CreateCustomerRequest.builder().build()); } + /** + * Creates a new customer for a business. + *

You must provide at least one of the following values in your request to this + * endpoint:

+ *
    + *
  • given_name
  • + *
  • family_name
  • + *
  • company_name
  • + *
  • email_address
  • + *
  • phone_number
  • + *
+ */ + public SquareClientHttpResponse create(RequestOptions requestOptions) { + return create(CreateCustomerRequest.builder().build(), requestOptions); + } + /** * Creates a new customer for a business. *

You must provide at least one of the following values in your request to this @@ -464,6 +490,19 @@ public SquareClientHttpResponse search() { return search(SearchCustomersRequest.builder().build()); } + /** + * Searches the customer profiles associated with a Square account using one or more supported query filters. + *

Calling SearchCustomers without any explicit query filter returns all + * customer profiles ordered alphabetically based on given_name and + * family_name.

+ *

Under normal operating conditions, newly created or updated customer profiles become available + * for the search operation in well under 30 seconds. Occasionally, propagation of the new or updated + * profiles can take closer to one minute or longer, especially during network incidents and outages.

+ */ + public SquareClientHttpResponse search(RequestOptions requestOptions) { + return search(SearchCustomersRequest.builder().build(), requestOptions); + } + /** * Searches the customer profiles associated with a Square account using one or more supported query filters. *

Calling SearchCustomers without any explicit query filter returns all diff --git a/src/main/java/com/squareup/square/RawDevicesClient.java b/src/main/java/com/squareup/square/RawDevicesClient.java index cf23c6c8..b16c7af8 100644 --- a/src/main/java/com/squareup/square/RawDevicesClient.java +++ b/src/main/java/com/squareup/square/RawDevicesClient.java @@ -42,6 +42,14 @@ public SquareClientHttpResponse> list() { return list(ListDevicesRequest.builder().build()); } + /** + * List devices associated with the merchant. Currently, only Terminal API + * devices are supported. + */ + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListDevicesRequest.builder().build(), requestOptions); + } + /** * List devices associated with the merchant. Currently, only Terminal API * devices are supported. diff --git a/src/main/java/com/squareup/square/RawDisputesClient.java b/src/main/java/com/squareup/square/RawDisputesClient.java index 88665e80..3471145d 100644 --- a/src/main/java/com/squareup/square/RawDisputesClient.java +++ b/src/main/java/com/squareup/square/RawDisputesClient.java @@ -55,6 +55,13 @@ public SquareClientHttpResponse> list() { return list(ListDisputesRequest.builder().build()); } + /** + * Returns a list of disputes associated with a particular account. + */ + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListDisputesRequest.builder().build(), requestOptions); + } + /** * Returns a list of disputes associated with a particular account. */ diff --git a/src/main/java/com/squareup/square/RawEmployeesClient.java b/src/main/java/com/squareup/square/RawEmployeesClient.java index ad7e5e60..93f25679 100644 --- a/src/main/java/com/squareup/square/RawEmployeesClient.java +++ b/src/main/java/com/squareup/square/RawEmployeesClient.java @@ -38,6 +38,10 @@ public SquareClientHttpResponse> list() { return list(ListEmployeesRequest.builder().build()); } + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListEmployeesRequest.builder().build(), requestOptions); + } + public SquareClientHttpResponse> list(ListEmployeesRequest request) { return list(request, null); } diff --git a/src/main/java/com/squareup/square/RawEventsClient.java b/src/main/java/com/squareup/square/RawEventsClient.java index ffa362a3..7eeec70b 100644 --- a/src/main/java/com/squareup/square/RawEventsClient.java +++ b/src/main/java/com/squareup/square/RawEventsClient.java @@ -41,6 +41,13 @@ public SquareClientHttpResponse searchEvents() { return searchEvents(SearchEventsRequest.builder().build()); } + /** + * Search for Square API events that occur within a 28-day timeframe. + */ + public SquareClientHttpResponse searchEvents(RequestOptions requestOptions) { + return searchEvents(SearchEventsRequest.builder().build(), requestOptions); + } + /** * Search for Square API events that occur within a 28-day timeframe. */ @@ -181,6 +188,13 @@ public SquareClientHttpResponse listEventTypes() { return listEventTypes(ListEventTypesRequest.builder().build()); } + /** + * Lists all event types that you can subscribe to as webhooks or query using the Events API. + */ + public SquareClientHttpResponse listEventTypes(RequestOptions requestOptions) { + return listEventTypes(ListEventTypesRequest.builder().build(), requestOptions); + } + /** * Lists all event types that you can subscribe to as webhooks or query using the Events API. */ diff --git a/src/main/java/com/squareup/square/RawGiftCardsClient.java b/src/main/java/com/squareup/square/RawGiftCardsClient.java index e95c4a7f..ed838efd 100644 --- a/src/main/java/com/squareup/square/RawGiftCardsClient.java +++ b/src/main/java/com/squareup/square/RawGiftCardsClient.java @@ -55,6 +55,14 @@ public SquareClientHttpResponse> list() { return list(ListGiftCardsRequest.builder().build()); } + /** + * Lists all gift cards. You can specify optional filters to retrieve + * a subset of the gift cards. Results are sorted by created_at in ascending order. + */ + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListGiftCardsRequest.builder().build(), requestOptions); + } + /** * Lists all gift cards. You can specify optional filters to retrieve * a subset of the gift cards. Results are sorted by created_at in ascending order. diff --git a/src/main/java/com/squareup/square/RawInventoryClient.java b/src/main/java/com/squareup/square/RawInventoryClient.java index d2983e99..e91bbd24 100644 --- a/src/main/java/com/squareup/square/RawInventoryClient.java +++ b/src/main/java/com/squareup/square/RawInventoryClient.java @@ -206,6 +206,16 @@ public SquareClientHttpResponse deprecatedBatc BatchRetrieveInventoryChangesRequest.builder().build()); } + /** + * Deprecated version of BatchRetrieveInventoryChanges after the endpoint URL + * is updated to conform to the standard convention. + */ + public SquareClientHttpResponse deprecatedBatchGetChanges( + RequestOptions requestOptions) { + return deprecatedBatchGetChanges( + BatchRetrieveInventoryChangesRequest.builder().build(), requestOptions); + } + /** * Deprecated version of BatchRetrieveInventoryChanges after the endpoint URL * is updated to conform to the standard convention. @@ -267,6 +277,15 @@ public SquareClientHttpResponse deprecatedBatch return deprecatedBatchGetCounts(BatchGetInventoryCountsRequest.builder().build()); } + /** + * Deprecated version of BatchRetrieveInventoryCounts after the endpoint URL + * is updated to conform to the standard convention. + */ + public SquareClientHttpResponse deprecatedBatchGetCounts( + RequestOptions requestOptions) { + return deprecatedBatchGetCounts(BatchGetInventoryCountsRequest.builder().build(), requestOptions); + } + /** * Deprecated version of BatchRetrieveInventoryCounts after the endpoint URL * is updated to conform to the standard convention. @@ -389,6 +408,19 @@ public SquareClientHttpResponse> batchGetCha return batchGetChanges(BatchRetrieveInventoryChangesRequest.builder().build()); } + /** + * Returns historical physical counts and adjustments based on the + * provided filter criteria. + *

Results are paginated and sorted in ascending order according their + * occurred_at timestamp (oldest first).

+ *

BatchRetrieveInventoryChanges is a catch-all query endpoint for queries + * that cannot be handled by other, simpler endpoints.

+ */ + public SquareClientHttpResponse> batchGetChanges( + RequestOptions requestOptions) { + return batchGetChanges(BatchRetrieveInventoryChangesRequest.builder().build(), requestOptions); + } + /** * Returns historical physical counts and adjustments based on the * provided filter criteria. @@ -476,6 +508,21 @@ public SquareClientHttpResponse> batchGetCoun return batchGetCounts(BatchGetInventoryCountsRequest.builder().build()); } + /** + * Returns current counts for the provided + * CatalogObjects at the requested + * Locations. + *

Results are paginated and sorted in descending order according to their + * calculated_at timestamp (newest first).

+ *

When updated_after is specified, only counts that have changed since that + * time (based on the server timestamp for the most recent change) are + * returned. This allows clients to perform a "sync" operation, for example + * in response to receiving a Webhook notification.

+ */ + public SquareClientHttpResponse> batchGetCounts(RequestOptions requestOptions) { + return batchGetCounts(BatchGetInventoryCountsRequest.builder().build(), requestOptions); + } + /** * Returns current counts for the provided * CatalogObjects at the requested diff --git a/src/main/java/com/squareup/square/RawLaborClient.java b/src/main/java/com/squareup/square/RawLaborClient.java index e6d18d31..9ef72a5d 100644 --- a/src/main/java/com/squareup/square/RawLaborClient.java +++ b/src/main/java/com/squareup/square/RawLaborClient.java @@ -184,6 +184,15 @@ public SquareClientHttpResponse searchScheduledSh return searchScheduledShifts(SearchScheduledShiftsRequest.builder().build()); } + /** + * Returns a paginated list of scheduled shifts, with optional filter and sort settings. + * By default, results are sorted by start_at in ascending order. + */ + public SquareClientHttpResponse searchScheduledShifts( + RequestOptions requestOptions) { + return searchScheduledShifts(SearchScheduledShiftsRequest.builder().build(), requestOptions); + } + /** * Returns a paginated list of scheduled shifts, with optional filter and sort settings. * By default, results are sorted by start_at in ascending order. @@ -517,6 +526,29 @@ public SquareClientHttpResponse searchTimecards() { return searchTimecards(SearchTimecardsRequest.builder().build()); } + /** + * Returns a paginated list of Timecard records for a business. + * The list to be returned can be filtered by: + *
    + *
  • Location IDs
  • + *
  • Team member IDs
  • + *
  • Timecard status (OPEN or CLOSED)
  • + *
  • Timecard start
  • + *
  • Timecard end
  • + *
  • Workday details
  • + *
+ *

The list can be sorted by:

+ *
    + *
  • START_AT
  • + *
  • END_AT
  • + *
  • CREATED_AT
  • + *
  • UPDATED_AT
  • + *
+ */ + public SquareClientHttpResponse searchTimecards(RequestOptions requestOptions) { + return searchTimecards(SearchTimecardsRequest.builder().build(), requestOptions); + } + /** * Returns a paginated list of Timecard records for a business. * The list to be returned can be filtered by: diff --git a/src/main/java/com/squareup/square/RawLocationsClient.java b/src/main/java/com/squareup/square/RawLocationsClient.java index 8d3f20ed..3368821b 100644 --- a/src/main/java/com/squareup/square/RawLocationsClient.java +++ b/src/main/java/com/squareup/square/RawLocationsClient.java @@ -91,6 +91,19 @@ public SquareClientHttpResponse create() { return create(CreateLocationRequest.builder().build()); } + /** + * Creates a location. + * Creating new locations allows for separate configuration of receipt layouts, item prices, + * and sales reports. Developers can use locations to separate sales activity through applications + * that integrate with Square from sales activity elsewhere in a seller's account. + * Locations created programmatically with the Locations API last forever and + * are visible to the seller for their own management. Therefore, ensure that + * each location has a sensible and unique name. + */ + public SquareClientHttpResponse create(RequestOptions requestOptions) { + return create(CreateLocationRequest.builder().build(), requestOptions); + } + /** * Creates a location. * Creating new locations allows for separate configuration of receipt layouts, item prices, diff --git a/src/main/java/com/squareup/square/RawLoyaltyClient.java b/src/main/java/com/squareup/square/RawLoyaltyClient.java index 3d467f15..c140cbef 100644 --- a/src/main/java/com/squareup/square/RawLoyaltyClient.java +++ b/src/main/java/com/squareup/square/RawLoyaltyClient.java @@ -41,6 +41,18 @@ public SquareClientHttpResponse searchEvents() { return searchEvents(SearchLoyaltyEventsRequest.builder().build()); } + /** + * Searches for loyalty events. + *

A Square loyalty program maintains a ledger of events that occur during the lifetime of a + * buyer's loyalty account. Each change in the point balance + * (for example, points earned, points redeemed, and points expired) is + * recorded in the ledger. Using this endpoint, you can search the ledger for events.

+ *

Search results are sorted by created_at in descending order.

+ */ + public SquareClientHttpResponse searchEvents(RequestOptions requestOptions) { + return searchEvents(SearchLoyaltyEventsRequest.builder().build(), requestOptions); + } + /** * Searches for loyalty events. *

A Square loyalty program maintains a ledger of events that occur during the lifetime of a diff --git a/src/main/java/com/squareup/square/RawMerchantsClient.java b/src/main/java/com/squareup/square/RawMerchantsClient.java index 50024a97..b3f0f61a 100644 --- a/src/main/java/com/squareup/square/RawMerchantsClient.java +++ b/src/main/java/com/squareup/square/RawMerchantsClient.java @@ -48,6 +48,20 @@ public SquareClientHttpResponse> list() { return list(ListMerchantsRequest.builder().build()); } + /** + * Provides details about the merchant associated with a given access token. + *

The access token used to connect your application to a Square seller is associated + * with a single merchant. That means that ListMerchants returns a list + * with a single Merchant object. You can specify your personal access token + * to get your own merchant information or specify an OAuth token to get the + * information for the merchant that granted your application access.

+ *

If you know the merchant ID, you can also use the RetrieveMerchant + * endpoint to retrieve the merchant information.

+ */ + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListMerchantsRequest.builder().build(), requestOptions); + } + /** * Provides details about the merchant associated with a given access token. *

The access token used to connect your application to a Square seller is associated diff --git a/src/main/java/com/squareup/square/RawMobileClient.java b/src/main/java/com/squareup/square/RawMobileClient.java index f4692fbc..c81e7f35 100644 --- a/src/main/java/com/squareup/square/RawMobileClient.java +++ b/src/main/java/com/squareup/square/RawMobileClient.java @@ -3,16 +3,12 @@ */ package com.squareup.square; -import com.fasterxml.jackson.core.JsonProcessingException; import com.squareup.square.core.ClientOptions; -import com.squareup.square.core.MediaTypes; import com.squareup.square.core.ObjectMappers; import com.squareup.square.core.RequestOptions; import com.squareup.square.core.SquareApiException; import com.squareup.square.core.SquareClientHttpResponse; import com.squareup.square.core.SquareException; -import com.squareup.square.types.CreateMobileAuthorizationCodeRequest; -import com.squareup.square.types.CreateMobileAuthorizationCodeResponse; import java.io.IOException; import okhttp3.Headers; import okhttp3.HttpUrl; @@ -29,67 +25,19 @@ public RawMobileClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - /** - * Note: This endpoint is used by the deprecated Reader SDK. - * Developers should update their integration to use the Mobile Payments SDK, which includes its own authorization methods. - *

Generates code to authorize a mobile application to connect to a Square card reader.

- *

Authorization codes are one-time-use codes and expire 60 minutes after being issued.

- *

The Authorization header you provide to this endpoint must have the following format:

- *
Authorization: Bearer ACCESS_TOKEN
-     * 
- *

Replace ACCESS_TOKEN with a - * valid production authorization credential.

- */ - public SquareClientHttpResponse authorizationCode() { - return authorizationCode(CreateMobileAuthorizationCodeRequest.builder().build()); + public SquareClientHttpResponse authorizationCode() { + return authorizationCode(null); } - /** - * Note: This endpoint is used by the deprecated Reader SDK. - * Developers should update their integration to use the Mobile Payments SDK, which includes its own authorization methods. - *

Generates code to authorize a mobile application to connect to a Square card reader.

- *

Authorization codes are one-time-use codes and expire 60 minutes after being issued.

- *

The Authorization header you provide to this endpoint must have the following format:

- *
Authorization: Bearer ACCESS_TOKEN
-     * 
- *

Replace ACCESS_TOKEN with a - * valid production authorization credential.

- */ - public SquareClientHttpResponse authorizationCode( - CreateMobileAuthorizationCodeRequest request) { - return authorizationCode(request, null); - } - - /** - * Note: This endpoint is used by the deprecated Reader SDK. - * Developers should update their integration to use the Mobile Payments SDK, which includes its own authorization methods. - *

Generates code to authorize a mobile application to connect to a Square card reader.

- *

Authorization codes are one-time-use codes and expire 60 minutes after being issued.

- *

The Authorization header you provide to this endpoint must have the following format:

- *
Authorization: Bearer ACCESS_TOKEN
-     * 
- *

Replace ACCESS_TOKEN with a - * valid production authorization credential.

- */ - public SquareClientHttpResponse authorizationCode( - CreateMobileAuthorizationCodeRequest request, RequestOptions requestOptions) { + public SquareClientHttpResponse authorizationCode(RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("mobile/authorization-code") .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new SquareException("Failed to serialize request", e); - } Request okhttpRequest = new Request.Builder() .url(httpUrl) - .method("POST", body) + .method("POST", RequestBody.create("", null)) .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); if (requestOptions != null && requestOptions.getTimeout().isPresent()) { @@ -97,13 +45,10 @@ public SquareClientHttpResponse authoriza } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new SquareClientHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, CreateMobileAuthorizationCodeResponse.class), - response); + return new SquareClientHttpResponse<>(null, response); } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new SquareApiException( "Error with status code " + response.code(), response.code(), errorBody, response); diff --git a/src/main/java/com/squareup/square/RawOAuthClient.java b/src/main/java/com/squareup/square/RawOAuthClient.java index c6db14a8..ffe99ed9 100644 --- a/src/main/java/com/squareup/square/RawOAuthClient.java +++ b/src/main/java/com/squareup/square/RawOAuthClient.java @@ -47,6 +47,21 @@ public SquareClientHttpResponse revokeToken() { return revokeToken(RevokeTokenRequest.builder().build()); } + /** + * Revokes an access token generated with the OAuth flow. + *

If an account has more than one OAuth access token for your application, this + * endpoint revokes all of them, regardless of which token you specify.

+ *

Important: The Authorization header for this endpoint must have the + * following format:

+ *
Authorization: Client APPLICATION_SECRET
+     * 
+ *

Replace APPLICATION_SECRET with the application secret on the OAuth + * page for your application in the Developer Dashboard.

+ */ + public SquareClientHttpResponse revokeToken(RequestOptions requestOptions) { + return revokeToken(RevokeTokenRequest.builder().build(), requestOptions); + } + /** * Revokes an access token generated with the OAuth flow. *

If an account has more than one OAuth access token for your application, this diff --git a/src/main/java/com/squareup/square/RawOrdersClient.java b/src/main/java/com/squareup/square/RawOrdersClient.java index 4669f70c..f511bd11 100644 --- a/src/main/java/com/squareup/square/RawOrdersClient.java +++ b/src/main/java/com/squareup/square/RawOrdersClient.java @@ -54,6 +54,17 @@ public SquareClientHttpResponse create() { return create(CreateOrderRequest.builder().build()); } + /** + * Creates a new order that can include information about products for + * purchase and settings to apply to the purchase. + *

To pay for a created order, see + * Pay for Orders.

+ *

You can modify open orders using the UpdateOrder endpoint.

+ */ + public SquareClientHttpResponse create(RequestOptions requestOptions) { + return create(CreateOrderRequest.builder().build(), requestOptions); + } + /** * Creates a new order that can include information about products for * purchase and settings to apply to the purchase. @@ -284,6 +295,26 @@ public SquareClientHttpResponse search() { return search(SearchOrdersRequest.builder().build()); } + /** + * Search all orders for one or more locations. Orders include all sales, + * returns, and exchanges regardless of how or when they entered the Square + * ecosystem (such as Point of Sale, Invoices, and Connect APIs). + *

SearchOrders requests need to specify which locations to search and define a + * SearchOrdersQuery object that controls + * how to sort or filter the results. Your SearchOrdersQuery can:

+ *

Set filter criteria. + * Set the sort order. + * Determine whether to return results as complete Order objects or as + * OrderEntry objects.

+ *

Note that details for orders processed with Square Point of Sale while in + * offline mode might not be transmitted to Square for up to 72 hours. Offline + * orders have a created_at value that reflects the time the order was created, + * not the time it was subsequently transmitted to Square.

+ */ + public SquareClientHttpResponse search(RequestOptions requestOptions) { + return search(SearchOrdersRequest.builder().build(), requestOptions); + } + /** * Search all orders for one or more locations. Orders include all sales, * returns, and exchanges regardless of how or when they entered the Square diff --git a/src/main/java/com/squareup/square/RawPaymentsClient.java b/src/main/java/com/squareup/square/RawPaymentsClient.java index 8a8ef0b0..92583f6b 100644 --- a/src/main/java/com/squareup/square/RawPaymentsClient.java +++ b/src/main/java/com/squareup/square/RawPaymentsClient.java @@ -57,6 +57,16 @@ public SquareClientHttpResponse> list() { return list(ListPaymentsRequest.builder().build()); } + /** + * Retrieves a list of payments taken by the account making the request. + *

Results are eventually consistent, and new payments or changes to payments might take several + * seconds to appear.

+ *

The maximum results per page is 100.

+ */ + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListPaymentsRequest.builder().build(), requestOptions); + } + /** * Retrieves a list of payments taken by the account making the request. *

Results are eventually consistent, and new payments or changes to payments might take several diff --git a/src/main/java/com/squareup/square/RawPayoutsClient.java b/src/main/java/com/squareup/square/RawPayoutsClient.java index 19ac9900..eb51971d 100644 --- a/src/main/java/com/squareup/square/RawPayoutsClient.java +++ b/src/main/java/com/squareup/square/RawPayoutsClient.java @@ -46,6 +46,15 @@ public SquareClientHttpResponse> list() { return list(ListPayoutsRequest.builder().build()); } + /** + * Retrieves a list of all payouts for the default location. + * You can filter payouts by location ID, status, time range, and order them in ascending or descending order. + * To call this endpoint, set PAYOUTS_READ for the OAuth scope. + */ + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListPayoutsRequest.builder().build(), requestOptions); + } + /** * Retrieves a list of all payouts for the default location. * You can filter payouts by location ID, status, time range, and order them in ascending or descending order. diff --git a/src/main/java/com/squareup/square/RawRefundsClient.java b/src/main/java/com/squareup/square/RawRefundsClient.java index 822d340d..43997ed3 100644 --- a/src/main/java/com/squareup/square/RawRefundsClient.java +++ b/src/main/java/com/squareup/square/RawRefundsClient.java @@ -49,6 +49,16 @@ public SquareClientHttpResponse> list() { return list(ListRefundsRequest.builder().build()); } + /** + * Retrieves a list of refunds for the account making the request. + *

Results are eventually consistent, and new refunds or changes to refunds might take several + * seconds to appear.

+ *

The maximum results per page is 100.

+ */ + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListRefundsRequest.builder().build(), requestOptions); + } + /** * Retrieves a list of refunds for the account making the request. *

Results are eventually consistent, and new refunds or changes to refunds might take several diff --git a/src/main/java/com/squareup/square/RawSubscriptionsClient.java b/src/main/java/com/squareup/square/RawSubscriptionsClient.java index 23846067..ac7a60bf 100644 --- a/src/main/java/com/squareup/square/RawSubscriptionsClient.java +++ b/src/main/java/com/squareup/square/RawSubscriptionsClient.java @@ -186,6 +186,24 @@ public SquareClientHttpResponse search() { return search(SearchSubscriptionsRequest.builder().build()); } + /** + * Searches for subscriptions. + *

Results are ordered chronologically by subscription creation date. If + * the request specifies more than one location ID, + * the endpoint orders the result + * by location ID, and then by creation date within each location. If no locations are given + * in the query, all locations are searched.

+ *

You can also optionally specify customer_ids to search by customer. + * If left unset, all customers + * associated with the specified locations are returned. + * If the request specifies customer IDs, the endpoint orders results + * first by location, within location by customer ID, and within + * customer by subscription creation date.

+ */ + public SquareClientHttpResponse search(RequestOptions requestOptions) { + return search(SearchSubscriptionsRequest.builder().build(), requestOptions); + } + /** * Searches for subscriptions. *

Results are ordered chronologically by subscription creation date. If diff --git a/src/main/java/com/squareup/square/RawTeamClient.java b/src/main/java/com/squareup/square/RawTeamClient.java index c8319aa4..cb41cea6 100644 --- a/src/main/java/com/squareup/square/RawTeamClient.java +++ b/src/main/java/com/squareup/square/RawTeamClient.java @@ -43,6 +43,13 @@ public SquareClientHttpResponse listJobs() { return listJobs(ListJobsRequest.builder().build()); } + /** + * Lists jobs in a seller account. Results are sorted by title in ascending order. + */ + public SquareClientHttpResponse listJobs(RequestOptions requestOptions) { + return listJobs(ListJobsRequest.builder().build(), requestOptions); + } + /** * Lists jobs in a seller account. Results are sorted by title in ascending order. */ diff --git a/src/main/java/com/squareup/square/RawTeamMembersClient.java b/src/main/java/com/squareup/square/RawTeamMembersClient.java index fda92c9d..5eb37132 100644 --- a/src/main/java/com/squareup/square/RawTeamMembersClient.java +++ b/src/main/java/com/squareup/square/RawTeamMembersClient.java @@ -52,6 +52,19 @@ public SquareClientHttpResponse create() { return create(CreateTeamMemberRequest.builder().build()); } + /** + * Creates a single TeamMember object. The TeamMember object is returned on successful creates. + * You must provide the following values in your request to this endpoint: + *

    + *
  • given_name
  • + *
  • family_name
  • + *
+ *

Learn about Troubleshooting the Team API.

+ */ + public SquareClientHttpResponse create(RequestOptions requestOptions) { + return create(CreateTeamMemberRequest.builder().build(), requestOptions); + } + /** * Creates a single TeamMember object. The TeamMember object is returned on successful creates. * You must provide the following values in your request to this endpoint: @@ -239,6 +252,15 @@ public SquareClientHttpResponse search() { return search(SearchTeamMembersRequest.builder().build()); } + /** + * Returns a paginated list of TeamMember objects for a business. + * The list can be filtered by location IDs, ACTIVE or INACTIVE status, or whether + * the team member is the Square account owner. + */ + public SquareClientHttpResponse search(RequestOptions requestOptions) { + return search(SearchTeamMembersRequest.builder().build(), requestOptions); + } + /** * Returns a paginated list of TeamMember objects for a business. * The list can be filtered by location IDs, ACTIVE or INACTIVE status, or whether diff --git a/src/main/java/com/squareup/square/RawTransferOrdersClient.java b/src/main/java/com/squareup/square/RawTransferOrdersClient.java index ebb22fd7..9c6c98d9 100644 --- a/src/main/java/com/squareup/square/RawTransferOrdersClient.java +++ b/src/main/java/com/squareup/square/RawTransferOrdersClient.java @@ -151,6 +151,20 @@ public SquareClientHttpResponse> search() { return search(SearchTransferOrdersRequest.builder().build()); } + /** + * Searches for transfer orders using filters. Returns a paginated list of matching + * TransferOrders sorted by creation date. + *

Common search scenarios:

+ * + */ + public SquareClientHttpResponse> search(RequestOptions requestOptions) { + return search(SearchTransferOrdersRequest.builder().build(), requestOptions); + } + /** * Searches for transfer orders using filters. Returns a paginated list of matching * TransferOrders sorted by creation date. diff --git a/src/main/java/com/squareup/square/RawVendorsClient.java b/src/main/java/com/squareup/square/RawVendorsClient.java index fd640751..56d7f4ef 100644 --- a/src/main/java/com/squareup/square/RawVendorsClient.java +++ b/src/main/java/com/squareup/square/RawVendorsClient.java @@ -98,6 +98,13 @@ public SquareClientHttpResponse batchGet() { return batchGet(BatchGetVendorsRequest.builder().build()); } + /** + * Retrieves one or more vendors of specified Vendor IDs. + */ + public SquareClientHttpResponse batchGet(RequestOptions requestOptions) { + return batchGet(BatchGetVendorsRequest.builder().build(), requestOptions); + } + /** * Retrieves one or more vendors of specified Vendor IDs. */ @@ -254,6 +261,13 @@ public SquareClientHttpResponse search() { return search(SearchVendorsRequest.builder().build()); } + /** + * Searches for vendors using a filter against supported Vendor properties and a supported sorter. + */ + public SquareClientHttpResponse search(RequestOptions requestOptions) { + return search(SearchVendorsRequest.builder().build(), requestOptions); + } + /** * Searches for vendors using a filter against supported Vendor properties and a supported sorter. */ diff --git a/src/main/java/com/squareup/square/RefundsClient.java b/src/main/java/com/squareup/square/RefundsClient.java index 42e429cb..9a31dd20 100644 --- a/src/main/java/com/squareup/square/RefundsClient.java +++ b/src/main/java/com/squareup/square/RefundsClient.java @@ -40,6 +40,16 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + /** + * Retrieves a list of refunds for the account making the request. + *

Results are eventually consistent, and new refunds or changes to refunds might take several + * seconds to appear.

+ *

The maximum results per page is 100.

+ */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + /** * Retrieves a list of refunds for the account making the request. *

Results are eventually consistent, and new refunds or changes to refunds might take several diff --git a/src/main/java/com/squareup/square/SquareClient.java b/src/main/java/com/squareup/square/SquareClient.java index 722d9a2e..28fdecc4 100644 --- a/src/main/java/com/squareup/square/SquareClient.java +++ b/src/main/java/com/squareup/square/SquareClient.java @@ -12,8 +12,6 @@ public class SquareClient { protected final ClientOptions clientOptions; - protected final Supplier mobileClient; - protected final Supplier oAuthClient; protected final Supplier v1TransactionsClient; @@ -80,13 +78,14 @@ public class SquareClient { protected final Supplier vendorsClient; + protected final Supplier mobileClient; + protected final Supplier cashDrawersClient; protected final Supplier webhooksClient; public SquareClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; - this.mobileClient = Suppliers.memoize(() -> new MobileClient(clientOptions)); this.oAuthClient = Suppliers.memoize(() -> new OAuthClient(clientOptions)); this.v1TransactionsClient = Suppliers.memoize(() -> new V1TransactionsClient(clientOptions)); this.applePayClient = Suppliers.memoize(() -> new ApplePayClient(clientOptions)); @@ -120,14 +119,11 @@ public SquareClient(ClientOptions clientOptions) { this.terminalClient = Suppliers.memoize(() -> new TerminalClient(clientOptions)); this.transferOrdersClient = Suppliers.memoize(() -> new TransferOrdersClient(clientOptions)); this.vendorsClient = Suppliers.memoize(() -> new VendorsClient(clientOptions)); + this.mobileClient = Suppliers.memoize(() -> new MobileClient(clientOptions)); this.cashDrawersClient = Suppliers.memoize(() -> new CashDrawersClient(clientOptions)); this.webhooksClient = Suppliers.memoize(() -> new WebhooksClient(clientOptions)); } - public MobileClient mobile() { - return this.mobileClient.get(); - } - public OAuthClient oAuth() { return this.oAuthClient.get(); } @@ -260,6 +256,10 @@ public VendorsClient vendors() { return this.vendorsClient.get(); } + public MobileClient mobile() { + return this.mobileClient.get(); + } + public CashDrawersClient cashDrawers() { return this.cashDrawersClient.get(); } diff --git a/src/main/java/com/squareup/square/SquareClientBuilder.java b/src/main/java/com/squareup/square/SquareClientBuilder.java index ae79625a..b9e55f12 100644 --- a/src/main/java/com/squareup/square/SquareClientBuilder.java +++ b/src/main/java/com/squareup/square/SquareClientBuilder.java @@ -19,7 +19,7 @@ public class SquareClientBuilder { private String token = System.getenv("SQUARE_TOKEN"); - private String version = "2025-10-16"; + private String version = "2026-01-22"; private Environment environment = Environment.PRODUCTION; diff --git a/src/main/java/com/squareup/square/SubscriptionsClient.java b/src/main/java/com/squareup/square/SubscriptionsClient.java index 66c44b32..9a033a53 100644 --- a/src/main/java/com/squareup/square/SubscriptionsClient.java +++ b/src/main/java/com/squareup/square/SubscriptionsClient.java @@ -106,6 +106,24 @@ public SearchSubscriptionsResponse search() { return this.rawClient.search().body(); } + /** + * Searches for subscriptions. + *

Results are ordered chronologically by subscription creation date. If + * the request specifies more than one location ID, + * the endpoint orders the result + * by location ID, and then by creation date within each location. If no locations are given + * in the query, all locations are searched.

+ *

You can also optionally specify customer_ids to search by customer. + * If left unset, all customers + * associated with the specified locations are returned. + * If the request specifies customer IDs, the endpoint orders results + * first by location, within location by customer ID, and within + * customer by subscription creation date.

+ */ + public SearchSubscriptionsResponse search(RequestOptions requestOptions) { + return this.rawClient.search(requestOptions).body(); + } + /** * Searches for subscriptions. *

Results are ordered chronologically by subscription creation date. If diff --git a/src/main/java/com/squareup/square/TeamClient.java b/src/main/java/com/squareup/square/TeamClient.java index b323f4e5..de508159 100644 --- a/src/main/java/com/squareup/square/TeamClient.java +++ b/src/main/java/com/squareup/square/TeamClient.java @@ -38,6 +38,13 @@ public ListJobsResponse listJobs() { return this.rawClient.listJobs().body(); } + /** + * Lists jobs in a seller account. Results are sorted by title in ascending order. + */ + public ListJobsResponse listJobs(RequestOptions requestOptions) { + return this.rawClient.listJobs(requestOptions).body(); + } + /** * Lists jobs in a seller account. Results are sorted by title in ascending order. */ diff --git a/src/main/java/com/squareup/square/TeamMembersClient.java b/src/main/java/com/squareup/square/TeamMembersClient.java index ed299c13..822ddddc 100644 --- a/src/main/java/com/squareup/square/TeamMembersClient.java +++ b/src/main/java/com/squareup/square/TeamMembersClient.java @@ -54,6 +54,19 @@ public CreateTeamMemberResponse create() { return this.rawClient.create().body(); } + /** + * Creates a single TeamMember object. The TeamMember object is returned on successful creates. + * You must provide the following values in your request to this endpoint: + *

    + *
  • given_name
  • + *
  • family_name
  • + *
+ *

Learn about Troubleshooting the Team API.

+ */ + public CreateTeamMemberResponse create(RequestOptions requestOptions) { + return this.rawClient.create(requestOptions).body(); + } + /** * Creates a single TeamMember object. The TeamMember object is returned on successful creates. * You must provide the following values in your request to this endpoint: @@ -135,6 +148,15 @@ public SearchTeamMembersResponse search() { return this.rawClient.search().body(); } + /** + * Returns a paginated list of TeamMember objects for a business. + * The list can be filtered by location IDs, ACTIVE or INACTIVE status, or whether + * the team member is the Square account owner. + */ + public SearchTeamMembersResponse search(RequestOptions requestOptions) { + return this.rawClient.search(requestOptions).body(); + } + /** * Returns a paginated list of TeamMember objects for a business. * The list can be filtered by location IDs, ACTIVE or INACTIVE status, or whether diff --git a/src/main/java/com/squareup/square/TransferOrdersClient.java b/src/main/java/com/squareup/square/TransferOrdersClient.java index 72153370..02de4326 100644 --- a/src/main/java/com/squareup/square/TransferOrdersClient.java +++ b/src/main/java/com/squareup/square/TransferOrdersClient.java @@ -106,6 +106,20 @@ public SyncPagingIterable search() { return this.rawClient.search().body(); } + /** + * Searches for transfer orders using filters. Returns a paginated list of matching + * TransferOrders sorted by creation date. + *

Common search scenarios:

+ * + */ + public SyncPagingIterable search(RequestOptions requestOptions) { + return this.rawClient.search(requestOptions).body(); + } + /** * Searches for transfer orders using filters. Returns a paginated list of matching * TransferOrders sorted by creation date. diff --git a/src/main/java/com/squareup/square/VendorsClient.java b/src/main/java/com/squareup/square/VendorsClient.java index fe4e7880..3e0e6277 100644 --- a/src/main/java/com/squareup/square/VendorsClient.java +++ b/src/main/java/com/squareup/square/VendorsClient.java @@ -58,6 +58,13 @@ public BatchGetVendorsResponse batchGet() { return this.rawClient.batchGet().body(); } + /** + * Retrieves one or more vendors of specified Vendor IDs. + */ + public BatchGetVendorsResponse batchGet(RequestOptions requestOptions) { + return this.rawClient.batchGet(requestOptions).body(); + } + /** * Retrieves one or more vendors of specified Vendor IDs. */ @@ -107,6 +114,13 @@ public SearchVendorsResponse search() { return this.rawClient.search().body(); } + /** + * Searches for vendors using a filter against supported Vendor properties and a supported sorter. + */ + public SearchVendorsResponse search(RequestOptions requestOptions) { + return this.rawClient.search(requestOptions).body(); + } + /** * Searches for vendors using a filter against supported Vendor properties and a supported sorter. */ diff --git a/src/main/java/com/squareup/square/bookings/AsyncCustomAttributeDefinitionsClient.java b/src/main/java/com/squareup/square/bookings/AsyncCustomAttributeDefinitionsClient.java index d9e531f7..b3c983ba 100644 --- a/src/main/java/com/squareup/square/bookings/AsyncCustomAttributeDefinitionsClient.java +++ b/src/main/java/com/squareup/square/bookings/AsyncCustomAttributeDefinitionsClient.java @@ -44,6 +44,15 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + /** + * Get all bookings custom attribute definitions. + *

To call this endpoint with buyer-level permissions, set APPOINTMENTS_READ for the OAuth scope. + * To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_READ and APPOINTMENTS_READ for the OAuth scope.

+ */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + /** * Get all bookings custom attribute definitions. *

To call this endpoint with buyer-level permissions, set APPOINTMENTS_READ for the OAuth scope. diff --git a/src/main/java/com/squareup/square/bookings/AsyncLocationProfilesClient.java b/src/main/java/com/squareup/square/bookings/AsyncLocationProfilesClient.java index 999c2052..7680674e 100644 --- a/src/main/java/com/squareup/square/bookings/AsyncLocationProfilesClient.java +++ b/src/main/java/com/squareup/square/bookings/AsyncLocationProfilesClient.java @@ -34,6 +34,13 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + /** + * Lists location booking profiles of a seller. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + /** * Lists location booking profiles of a seller. */ diff --git a/src/main/java/com/squareup/square/bookings/AsyncRawCustomAttributeDefinitionsClient.java b/src/main/java/com/squareup/square/bookings/AsyncRawCustomAttributeDefinitionsClient.java index fad95255..b6ff9655 100644 --- a/src/main/java/com/squareup/square/bookings/AsyncRawCustomAttributeDefinitionsClient.java +++ b/src/main/java/com/squareup/square/bookings/AsyncRawCustomAttributeDefinitionsClient.java @@ -57,6 +57,16 @@ public CompletableFutureTo call this endpoint with buyer-level permissions, set APPOINTMENTS_READ for the OAuth scope. + * To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_READ and APPOINTMENTS_READ for the OAuth scope.

+ */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListCustomAttributeDefinitionsRequest.builder().build(), requestOptions); + } + /** * Get all bookings custom attribute definitions. *

To call this endpoint with buyer-level permissions, set APPOINTMENTS_READ for the OAuth scope. diff --git a/src/main/java/com/squareup/square/bookings/AsyncRawLocationProfilesClient.java b/src/main/java/com/squareup/square/bookings/AsyncRawLocationProfilesClient.java index 94c126be..2db7c4a1 100644 --- a/src/main/java/com/squareup/square/bookings/AsyncRawLocationProfilesClient.java +++ b/src/main/java/com/squareup/square/bookings/AsyncRawLocationProfilesClient.java @@ -44,6 +44,14 @@ public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListLocationProfilesRequest.builder().build(), requestOptions); + } + /** * Lists location booking profiles of a seller. */ diff --git a/src/main/java/com/squareup/square/bookings/AsyncRawTeamMemberProfilesClient.java b/src/main/java/com/squareup/square/bookings/AsyncRawTeamMemberProfilesClient.java index a8805904..f6867ef0 100644 --- a/src/main/java/com/squareup/square/bookings/AsyncRawTeamMemberProfilesClient.java +++ b/src/main/java/com/squareup/square/bookings/AsyncRawTeamMemberProfilesClient.java @@ -46,6 +46,14 @@ public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListTeamMemberProfilesRequest.builder().build(), requestOptions); + } + /** * Lists booking profiles for team members. */ diff --git a/src/main/java/com/squareup/square/bookings/AsyncTeamMemberProfilesClient.java b/src/main/java/com/squareup/square/bookings/AsyncTeamMemberProfilesClient.java index 85d4b99b..51ca93e3 100644 --- a/src/main/java/com/squareup/square/bookings/AsyncTeamMemberProfilesClient.java +++ b/src/main/java/com/squareup/square/bookings/AsyncTeamMemberProfilesClient.java @@ -36,6 +36,13 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + /** + * Lists booking profiles for team members. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + /** * Lists booking profiles for team members. */ diff --git a/src/main/java/com/squareup/square/bookings/CustomAttributeDefinitionsClient.java b/src/main/java/com/squareup/square/bookings/CustomAttributeDefinitionsClient.java index c3c48dfc..f86868fb 100644 --- a/src/main/java/com/squareup/square/bookings/CustomAttributeDefinitionsClient.java +++ b/src/main/java/com/squareup/square/bookings/CustomAttributeDefinitionsClient.java @@ -43,6 +43,15 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + /** + * Get all bookings custom attribute definitions. + *

To call this endpoint with buyer-level permissions, set APPOINTMENTS_READ for the OAuth scope. + * To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_READ and APPOINTMENTS_READ for the OAuth scope.

+ */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + /** * Get all bookings custom attribute definitions. *

To call this endpoint with buyer-level permissions, set APPOINTMENTS_READ for the OAuth scope. diff --git a/src/main/java/com/squareup/square/bookings/LocationProfilesClient.java b/src/main/java/com/squareup/square/bookings/LocationProfilesClient.java index 6066cc22..6723e4e9 100644 --- a/src/main/java/com/squareup/square/bookings/LocationProfilesClient.java +++ b/src/main/java/com/squareup/square/bookings/LocationProfilesClient.java @@ -33,6 +33,13 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + /** + * Lists location booking profiles of a seller. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + /** * Lists location booking profiles of a seller. */ diff --git a/src/main/java/com/squareup/square/bookings/RawCustomAttributeDefinitionsClient.java b/src/main/java/com/squareup/square/bookings/RawCustomAttributeDefinitionsClient.java index 1d294a28..6ff7c97b 100644 --- a/src/main/java/com/squareup/square/bookings/RawCustomAttributeDefinitionsClient.java +++ b/src/main/java/com/squareup/square/bookings/RawCustomAttributeDefinitionsClient.java @@ -52,6 +52,15 @@ public SquareClientHttpResponse> l return list(ListCustomAttributeDefinitionsRequest.builder().build()); } + /** + * Get all bookings custom attribute definitions. + *

To call this endpoint with buyer-level permissions, set APPOINTMENTS_READ for the OAuth scope. + * To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_READ and APPOINTMENTS_READ for the OAuth scope.

+ */ + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListCustomAttributeDefinitionsRequest.builder().build(), requestOptions); + } + /** * Get all bookings custom attribute definitions. *

To call this endpoint with buyer-level permissions, set APPOINTMENTS_READ for the OAuth scope. diff --git a/src/main/java/com/squareup/square/bookings/RawLocationProfilesClient.java b/src/main/java/com/squareup/square/bookings/RawLocationProfilesClient.java index a886c2cc..c7a9751b 100644 --- a/src/main/java/com/squareup/square/bookings/RawLocationProfilesClient.java +++ b/src/main/java/com/squareup/square/bookings/RawLocationProfilesClient.java @@ -39,6 +39,13 @@ public SquareClientHttpResponse> list return list(ListLocationProfilesRequest.builder().build()); } + /** + * Lists location booking profiles of a seller. + */ + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListLocationProfilesRequest.builder().build(), requestOptions); + } + /** * Lists location booking profiles of a seller. */ diff --git a/src/main/java/com/squareup/square/bookings/RawTeamMemberProfilesClient.java b/src/main/java/com/squareup/square/bookings/RawTeamMemberProfilesClient.java index e5549cff..49390f16 100644 --- a/src/main/java/com/squareup/square/bookings/RawTeamMemberProfilesClient.java +++ b/src/main/java/com/squareup/square/bookings/RawTeamMemberProfilesClient.java @@ -41,6 +41,13 @@ public SquareClientHttpResponse> li return list(ListTeamMemberProfilesRequest.builder().build()); } + /** + * Lists booking profiles for team members. + */ + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListTeamMemberProfilesRequest.builder().build(), requestOptions); + } + /** * Lists booking profiles for team members. */ diff --git a/src/main/java/com/squareup/square/bookings/TeamMemberProfilesClient.java b/src/main/java/com/squareup/square/bookings/TeamMemberProfilesClient.java index 353f706b..d41278cc 100644 --- a/src/main/java/com/squareup/square/bookings/TeamMemberProfilesClient.java +++ b/src/main/java/com/squareup/square/bookings/TeamMemberProfilesClient.java @@ -35,6 +35,13 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + /** + * Lists booking profiles for team members. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + /** * Lists booking profiles for team members. */ diff --git a/src/main/java/com/squareup/square/catalog/AsyncImagesClient.java b/src/main/java/com/squareup/square/catalog/AsyncImagesClient.java index fda57e3b..a390e342 100644 --- a/src/main/java/com/squareup/square/catalog/AsyncImagesClient.java +++ b/src/main/java/com/squareup/square/catalog/AsyncImagesClient.java @@ -41,6 +41,17 @@ public CompletableFuture create() { return this.rawClient.create().thenApply(response -> response.body()); } + /** + * Uploads an image file to be represented by a CatalogImage object that can be linked to an existing + * CatalogObject instance. The resulting CatalogImage is unattached to any CatalogObject if the object_id + * is not specified. + *

This CreateCatalogImage endpoint accepts HTTP multipart/form-data requests with a JSON part and an image file part in + * JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB.

+ */ + public CompletableFuture create(RequestOptions requestOptions) { + return this.rawClient.create(requestOptions).thenApply(response -> response.body()); + } + /** * Uploads an image file to be represented by a CatalogImage object that can be linked to an existing * CatalogObject instance. The resulting CatalogImage is unattached to any CatalogObject if the object_id diff --git a/src/main/java/com/squareup/square/catalog/AsyncRawImagesClient.java b/src/main/java/com/squareup/square/catalog/AsyncRawImagesClient.java index 0171f31a..49731850 100644 --- a/src/main/java/com/squareup/square/catalog/AsyncRawImagesClient.java +++ b/src/main/java/com/squareup/square/catalog/AsyncRawImagesClient.java @@ -49,6 +49,18 @@ public CompletableFuture> c return create(CreateImagesRequest.builder().build()); } + /** + * Uploads an image file to be represented by a CatalogImage object that can be linked to an existing + * CatalogObject instance. The resulting CatalogImage is unattached to any CatalogObject if the object_id + * is not specified. + *

This CreateCatalogImage endpoint accepts HTTP multipart/form-data requests with a JSON part and an image file part in + * JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB.

+ */ + public CompletableFuture> create( + RequestOptions requestOptions) { + return create(CreateImagesRequest.builder().build(), requestOptions); + } + /** * Uploads an image file to be represented by a CatalogImage object that can be linked to an existing * CatalogObject instance. The resulting CatalogImage is unattached to any CatalogObject if the object_id diff --git a/src/main/java/com/squareup/square/catalog/ImagesClient.java b/src/main/java/com/squareup/square/catalog/ImagesClient.java index 58ff02be..da2aba09 100644 --- a/src/main/java/com/squareup/square/catalog/ImagesClient.java +++ b/src/main/java/com/squareup/square/catalog/ImagesClient.java @@ -40,6 +40,17 @@ public CreateCatalogImageResponse create() { return this.rawClient.create().body(); } + /** + * Uploads an image file to be represented by a CatalogImage object that can be linked to an existing + * CatalogObject instance. The resulting CatalogImage is unattached to any CatalogObject if the object_id + * is not specified. + *

This CreateCatalogImage endpoint accepts HTTP multipart/form-data requests with a JSON part and an image file part in + * JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB.

+ */ + public CreateCatalogImageResponse create(RequestOptions requestOptions) { + return this.rawClient.create(requestOptions).body(); + } + /** * Uploads an image file to be represented by a CatalogImage object that can be linked to an existing * CatalogObject instance. The resulting CatalogImage is unattached to any CatalogObject if the object_id diff --git a/src/main/java/com/squareup/square/catalog/RawImagesClient.java b/src/main/java/com/squareup/square/catalog/RawImagesClient.java index ee8826ed..966bd4a1 100644 --- a/src/main/java/com/squareup/square/catalog/RawImagesClient.java +++ b/src/main/java/com/squareup/square/catalog/RawImagesClient.java @@ -45,6 +45,17 @@ public SquareClientHttpResponse create() { return create(CreateImagesRequest.builder().build()); } + /** + * Uploads an image file to be represented by a CatalogImage object that can be linked to an existing + * CatalogObject instance. The resulting CatalogImage is unattached to any CatalogObject if the object_id + * is not specified. + *

This CreateCatalogImage endpoint accepts HTTP multipart/form-data requests with a JSON part and an image file part in + * JPEG, PJPEG, PNG, or GIF format. The maximum file size is 15MB.

+ */ + public SquareClientHttpResponse create(RequestOptions requestOptions) { + return create(CreateImagesRequest.builder().build(), requestOptions); + } + /** * Uploads an image file to be represented by a CatalogImage object that can be linked to an existing * CatalogObject instance. The resulting CatalogImage is unattached to any CatalogObject if the object_id diff --git a/src/main/java/com/squareup/square/checkout/AsyncPaymentLinksClient.java b/src/main/java/com/squareup/square/checkout/AsyncPaymentLinksClient.java index 03f582e1..90b9c19d 100644 --- a/src/main/java/com/squareup/square/checkout/AsyncPaymentLinksClient.java +++ b/src/main/java/com/squareup/square/checkout/AsyncPaymentLinksClient.java @@ -42,6 +42,13 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + /** + * Lists all payment links. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + /** * Lists all payment links. */ @@ -64,6 +71,13 @@ public CompletableFuture create() { return this.rawClient.create().thenApply(response -> response.body()); } + /** + * Creates a Square-hosted checkout page. Applications can share the resulting payment link with their buyer to pay for goods and services. + */ + public CompletableFuture create(RequestOptions requestOptions) { + return this.rawClient.create(requestOptions).thenApply(response -> response.body()); + } + /** * Creates a Square-hosted checkout page. Applications can share the resulting payment link with their buyer to pay for goods and services. */ diff --git a/src/main/java/com/squareup/square/checkout/AsyncRawPaymentLinksClient.java b/src/main/java/com/squareup/square/checkout/AsyncRawPaymentLinksClient.java index 7af04e93..aaecc94a 100644 --- a/src/main/java/com/squareup/square/checkout/AsyncRawPaymentLinksClient.java +++ b/src/main/java/com/squareup/square/checkout/AsyncRawPaymentLinksClient.java @@ -55,6 +55,14 @@ public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListPaymentLinksRequest.builder().build(), requestOptions); + } + /** * Lists all payment links. */ @@ -143,6 +151,14 @@ public CompletableFuture> cr return create(CreatePaymentLinkRequest.builder().build()); } + /** + * Creates a Square-hosted checkout page. Applications can share the resulting payment link with their buyer to pay for goods and services. + */ + public CompletableFuture> create( + RequestOptions requestOptions) { + return create(CreatePaymentLinkRequest.builder().build(), requestOptions); + } + /** * Creates a Square-hosted checkout page. Applications can share the resulting payment link with their buyer to pay for goods and services. */ diff --git a/src/main/java/com/squareup/square/checkout/PaymentLinksClient.java b/src/main/java/com/squareup/square/checkout/PaymentLinksClient.java index 26815e19..de6ec4e3 100644 --- a/src/main/java/com/squareup/square/checkout/PaymentLinksClient.java +++ b/src/main/java/com/squareup/square/checkout/PaymentLinksClient.java @@ -41,6 +41,13 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + /** + * Lists all payment links. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + /** * Lists all payment links. */ @@ -62,6 +69,13 @@ public CreatePaymentLinkResponse create() { return this.rawClient.create().body(); } + /** + * Creates a Square-hosted checkout page. Applications can share the resulting payment link with their buyer to pay for goods and services. + */ + public CreatePaymentLinkResponse create(RequestOptions requestOptions) { + return this.rawClient.create(requestOptions).body(); + } + /** * Creates a Square-hosted checkout page. Applications can share the resulting payment link with their buyer to pay for goods and services. */ diff --git a/src/main/java/com/squareup/square/checkout/RawPaymentLinksClient.java b/src/main/java/com/squareup/square/checkout/RawPaymentLinksClient.java index 15df312a..2fdb9771 100644 --- a/src/main/java/com/squareup/square/checkout/RawPaymentLinksClient.java +++ b/src/main/java/com/squareup/square/checkout/RawPaymentLinksClient.java @@ -50,6 +50,13 @@ public SquareClientHttpResponse> list() { return list(ListPaymentLinksRequest.builder().build()); } + /** + * Lists all payment links. + */ + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListPaymentLinksRequest.builder().build(), requestOptions); + } + /** * Lists all payment links. */ @@ -117,6 +124,13 @@ public SquareClientHttpResponse create() { return create(CreatePaymentLinkRequest.builder().build()); } + /** + * Creates a Square-hosted checkout page. Applications can share the resulting payment link with their buyer to pay for goods and services. + */ + public SquareClientHttpResponse create(RequestOptions requestOptions) { + return create(CreatePaymentLinkRequest.builder().build(), requestOptions); + } + /** * Creates a Square-hosted checkout page. Applications can share the resulting payment link with their buyer to pay for goods and services. */ diff --git a/src/main/java/com/squareup/square/core/AsyncCustomPager.java b/src/main/java/com/squareup/square/core/AsyncCustomPager.java index 74085142..25daac44 100644 --- a/src/main/java/com/squareup/square/core/AsyncCustomPager.java +++ b/src/main/java/com/squareup/square/core/AsyncCustomPager.java @@ -62,12 +62,12 @@ public class AsyncCustomPager implements BiDirectionalPage { * Create an AsyncCustomPager from an initial response. * * @param initialResponse The first page response from the API - * @param client The async HTTP client to use for subsequent requests + * @param clientOptions The client options containing HTTP client and other configuration * @param requestOptions Request options for authentication, headers, etc. * @return A CompletableFuture containing the new AsyncCustomPager instance */ public static CompletableFuture> createAsync( - Object initialResponse, okhttp3.OkHttpClient client, Object requestOptions) { + Object initialResponse, ClientOptions clientOptions, Object requestOptions) { throw new UnsupportedOperationException("AsyncCustomPager must be implemented. " + "Please implement this class in core/AsyncCustomPager.java to define your async pagination logic. " + "This file has been added to .fernignore and will not be overwritten. " diff --git a/src/main/java/com/squareup/square/core/ClientOptions.java b/src/main/java/com/squareup/square/core/ClientOptions.java index 36eac4e9..54c47564 100644 --- a/src/main/java/com/squareup/square/core/ClientOptions.java +++ b/src/main/java/com/squareup/square/core/ClientOptions.java @@ -35,10 +35,10 @@ private ClientOptions( this.headers.putAll(headers); this.headers.putAll(new HashMap() { { - put("User-Agent", "com.squareup:square/45.2.0.20251016"); + put("User-Agent", "com.squareup:square/46.0.0.20260122"); put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.square.fern:api-sdk"); - put("X-Fern-SDK-Version", "45.2.0.20251016"); + put("X-Fern-SDK-Version", "46.0.0.20260122"); } }); this.headerSuppliers = headerSuppliers; @@ -185,6 +185,9 @@ public static Builder from(ClientOptions clientOptions) { builder.environment = clientOptions.environment(); builder.timeout = Optional.of(clientOptions.timeout(null)); builder.httpClient = clientOptions.httpClient(); + builder.headers.putAll(clientOptions.headers); + builder.headerSuppliers.putAll(clientOptions.headerSuppliers); + builder.maxRetries = clientOptions.maxRetries(); return builder; } } diff --git a/src/main/java/com/squareup/square/core/CustomPager.java b/src/main/java/com/squareup/square/core/CustomPager.java index 892f86a1..337d8117 100644 --- a/src/main/java/com/squareup/square/core/CustomPager.java +++ b/src/main/java/com/squareup/square/core/CustomPager.java @@ -60,12 +60,12 @@ public class CustomPager implements BiDirectionalPage, Iterable { * Create a CustomPager from an initial response. * * @param initialResponse The first page response from the API - * @param client The HTTP client to use for subsequent requests + * @param clientOptions The client options containing HTTP client and other configuration * @param requestOptions Request options for authentication, headers, etc. * @return A new CustomPager instance * @throws IOException if the request fails */ - public static CustomPager create(Object initialResponse, okhttp3.OkHttpClient client, Object requestOptions) + public static CustomPager create(Object initialResponse, ClientOptions clientOptions, Object requestOptions) throws IOException { throw new UnsupportedOperationException("CustomPager must be implemented. " + "Please implement this class in core/CustomPager.java to define your pagination logic. " diff --git a/src/main/java/com/squareup/square/customers/AsyncCustomAttributeDefinitionsClient.java b/src/main/java/com/squareup/square/customers/AsyncCustomAttributeDefinitionsClient.java index 638f3fc5..59057061 100644 --- a/src/main/java/com/squareup/square/customers/AsyncCustomAttributeDefinitionsClient.java +++ b/src/main/java/com/squareup/square/customers/AsyncCustomAttributeDefinitionsClient.java @@ -48,6 +48,17 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + /** + * Lists the customer-related custom attribute definitions that belong to a Square seller account. + *

When all response pages are retrieved, the results include all custom attribute definitions + * that are visible to the requesting application, including those that are created by other + * applications and set to VISIBILITY_READ_ONLY or VISIBILITY_READ_WRITE_VALUES. Note that + * seller-defined custom attributes (also known as custom fields) are always set to VISIBILITY_READ_WRITE_VALUES.

+ */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + /** * Lists the customer-related custom attribute definitions that belong to a Square seller account. *

When all response pages are retrieved, the results include all custom attribute definitions diff --git a/src/main/java/com/squareup/square/customers/AsyncGroupsClient.java b/src/main/java/com/squareup/square/customers/AsyncGroupsClient.java index db109c00..735e5b2b 100644 --- a/src/main/java/com/squareup/square/customers/AsyncGroupsClient.java +++ b/src/main/java/com/squareup/square/customers/AsyncGroupsClient.java @@ -46,6 +46,13 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + /** + * Retrieves the list of customer groups of a business. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + /** * Retrieves the list of customer groups of a business. */ diff --git a/src/main/java/com/squareup/square/customers/AsyncRawCustomAttributeDefinitionsClient.java b/src/main/java/com/squareup/square/customers/AsyncRawCustomAttributeDefinitionsClient.java index 96e6620c..f17ae83b 100644 --- a/src/main/java/com/squareup/square/customers/AsyncRawCustomAttributeDefinitionsClient.java +++ b/src/main/java/com/squareup/square/customers/AsyncRawCustomAttributeDefinitionsClient.java @@ -61,6 +61,18 @@ public CompletableFuturecustom attribute definitions that belong to a Square seller account. + *

When all response pages are retrieved, the results include all custom attribute definitions + * that are visible to the requesting application, including those that are created by other + * applications and set to VISIBILITY_READ_ONLY or VISIBILITY_READ_WRITE_VALUES. Note that + * seller-defined custom attributes (also known as custom fields) are always set to VISIBILITY_READ_WRITE_VALUES.

+ */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListCustomAttributeDefinitionsRequest.builder().build(), requestOptions); + } + /** * Lists the customer-related custom attribute definitions that belong to a Square seller account. *

When all response pages are retrieved, the results include all custom attribute definitions diff --git a/src/main/java/com/squareup/square/customers/AsyncRawGroupsClient.java b/src/main/java/com/squareup/square/customers/AsyncRawGroupsClient.java index 78d823b6..935285f9 100644 --- a/src/main/java/com/squareup/square/customers/AsyncRawGroupsClient.java +++ b/src/main/java/com/squareup/square/customers/AsyncRawGroupsClient.java @@ -59,6 +59,14 @@ public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListGroupsRequest.builder().build(), requestOptions); + } + /** * Retrieves the list of customer groups of a business. */ diff --git a/src/main/java/com/squareup/square/customers/AsyncRawSegmentsClient.java b/src/main/java/com/squareup/square/customers/AsyncRawSegmentsClient.java index 29705d68..f6433613 100644 --- a/src/main/java/com/squareup/square/customers/AsyncRawSegmentsClient.java +++ b/src/main/java/com/squareup/square/customers/AsyncRawSegmentsClient.java @@ -46,6 +46,14 @@ public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListSegmentsRequest.builder().build(), requestOptions); + } + /** * Retrieves the list of customer segments of a business. */ diff --git a/src/main/java/com/squareup/square/customers/AsyncSegmentsClient.java b/src/main/java/com/squareup/square/customers/AsyncSegmentsClient.java index 4c8949b1..0b4e2674 100644 --- a/src/main/java/com/squareup/square/customers/AsyncSegmentsClient.java +++ b/src/main/java/com/squareup/square/customers/AsyncSegmentsClient.java @@ -36,6 +36,13 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + /** + * Retrieves the list of customer segments of a business. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + /** * Retrieves the list of customer segments of a business. */ diff --git a/src/main/java/com/squareup/square/customers/CustomAttributeDefinitionsClient.java b/src/main/java/com/squareup/square/customers/CustomAttributeDefinitionsClient.java index f46f18ab..5ef52439 100644 --- a/src/main/java/com/squareup/square/customers/CustomAttributeDefinitionsClient.java +++ b/src/main/java/com/squareup/square/customers/CustomAttributeDefinitionsClient.java @@ -47,6 +47,17 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + /** + * Lists the customer-related custom attribute definitions that belong to a Square seller account. + *

When all response pages are retrieved, the results include all custom attribute definitions + * that are visible to the requesting application, including those that are created by other + * applications and set to VISIBILITY_READ_ONLY or VISIBILITY_READ_WRITE_VALUES. Note that + * seller-defined custom attributes (also known as custom fields) are always set to VISIBILITY_READ_WRITE_VALUES.

+ */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + /** * Lists the customer-related custom attribute definitions that belong to a Square seller account. *

When all response pages are retrieved, the results include all custom attribute definitions diff --git a/src/main/java/com/squareup/square/customers/GroupsClient.java b/src/main/java/com/squareup/square/customers/GroupsClient.java index 392adb8e..2d217479 100644 --- a/src/main/java/com/squareup/square/customers/GroupsClient.java +++ b/src/main/java/com/squareup/square/customers/GroupsClient.java @@ -45,6 +45,13 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + /** + * Retrieves the list of customer groups of a business. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + /** * Retrieves the list of customer groups of a business. */ diff --git a/src/main/java/com/squareup/square/customers/RawCustomAttributeDefinitionsClient.java b/src/main/java/com/squareup/square/customers/RawCustomAttributeDefinitionsClient.java index 5e862fa1..d10a3e31 100644 --- a/src/main/java/com/squareup/square/customers/RawCustomAttributeDefinitionsClient.java +++ b/src/main/java/com/squareup/square/customers/RawCustomAttributeDefinitionsClient.java @@ -56,6 +56,17 @@ public SquareClientHttpResponse> l return list(ListCustomAttributeDefinitionsRequest.builder().build()); } + /** + * Lists the customer-related custom attribute definitions that belong to a Square seller account. + *

When all response pages are retrieved, the results include all custom attribute definitions + * that are visible to the requesting application, including those that are created by other + * applications and set to VISIBILITY_READ_ONLY or VISIBILITY_READ_WRITE_VALUES. Note that + * seller-defined custom attributes (also known as custom fields) are always set to VISIBILITY_READ_WRITE_VALUES.

+ */ + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListCustomAttributeDefinitionsRequest.builder().build(), requestOptions); + } + /** * Lists the customer-related custom attribute definitions that belong to a Square seller account. *

When all response pages are retrieved, the results include all custom attribute definitions diff --git a/src/main/java/com/squareup/square/customers/RawGroupsClient.java b/src/main/java/com/squareup/square/customers/RawGroupsClient.java index f04ff5a3..36a7f5d6 100644 --- a/src/main/java/com/squareup/square/customers/RawGroupsClient.java +++ b/src/main/java/com/squareup/square/customers/RawGroupsClient.java @@ -54,6 +54,13 @@ public SquareClientHttpResponse> list() { return list(ListGroupsRequest.builder().build()); } + /** + * Retrieves the list of customer groups of a business. + */ + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListGroupsRequest.builder().build(), requestOptions); + } + /** * Retrieves the list of customer groups of a business. */ diff --git a/src/main/java/com/squareup/square/customers/RawSegmentsClient.java b/src/main/java/com/squareup/square/customers/RawSegmentsClient.java index 2475d474..814ceb9b 100644 --- a/src/main/java/com/squareup/square/customers/RawSegmentsClient.java +++ b/src/main/java/com/squareup/square/customers/RawSegmentsClient.java @@ -41,6 +41,13 @@ public SquareClientHttpResponse> list() { return list(ListSegmentsRequest.builder().build()); } + /** + * Retrieves the list of customer segments of a business. + */ + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListSegmentsRequest.builder().build(), requestOptions); + } + /** * Retrieves the list of customer segments of a business. */ diff --git a/src/main/java/com/squareup/square/customers/SegmentsClient.java b/src/main/java/com/squareup/square/customers/SegmentsClient.java index e9f5ce8f..50ced8cc 100644 --- a/src/main/java/com/squareup/square/customers/SegmentsClient.java +++ b/src/main/java/com/squareup/square/customers/SegmentsClient.java @@ -35,6 +35,13 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + /** + * Retrieves the list of customer segments of a business. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + /** * Retrieves the list of customer segments of a business. */ diff --git a/src/main/java/com/squareup/square/devices/AsyncCodesClient.java b/src/main/java/com/squareup/square/devices/AsyncCodesClient.java index 4da35eb7..ae0fc192 100644 --- a/src/main/java/com/squareup/square/devices/AsyncCodesClient.java +++ b/src/main/java/com/squareup/square/devices/AsyncCodesClient.java @@ -38,6 +38,13 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + /** + * Lists all DeviceCodes associated with the merchant. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + /** * Lists all DeviceCodes associated with the merchant. */ diff --git a/src/main/java/com/squareup/square/devices/AsyncRawCodesClient.java b/src/main/java/com/squareup/square/devices/AsyncRawCodesClient.java index d0f18a14..0b3135c2 100644 --- a/src/main/java/com/squareup/square/devices/AsyncRawCodesClient.java +++ b/src/main/java/com/squareup/square/devices/AsyncRawCodesClient.java @@ -51,6 +51,14 @@ public CompletableFuture return list(ListCodesRequest.builder().build()); } + /** + * Lists all DeviceCodes associated with the merchant. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListCodesRequest.builder().build(), requestOptions); + } + /** * Lists all DeviceCodes associated with the merchant. */ diff --git a/src/main/java/com/squareup/square/devices/CodesClient.java b/src/main/java/com/squareup/square/devices/CodesClient.java index d75e0996..7eb7f740 100644 --- a/src/main/java/com/squareup/square/devices/CodesClient.java +++ b/src/main/java/com/squareup/square/devices/CodesClient.java @@ -37,6 +37,13 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + /** + * Lists all DeviceCodes associated with the merchant. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + /** * Lists all DeviceCodes associated with the merchant. */ diff --git a/src/main/java/com/squareup/square/devices/RawCodesClient.java b/src/main/java/com/squareup/square/devices/RawCodesClient.java index b29096d8..6092b3f3 100644 --- a/src/main/java/com/squareup/square/devices/RawCodesClient.java +++ b/src/main/java/com/squareup/square/devices/RawCodesClient.java @@ -46,6 +46,13 @@ public SquareClientHttpResponse> list() { return list(ListCodesRequest.builder().build()); } + /** + * Lists all DeviceCodes associated with the merchant. + */ + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListCodesRequest.builder().build(), requestOptions); + } + /** * Lists all DeviceCodes associated with the merchant. */ diff --git a/src/main/java/com/squareup/square/giftcards/ActivitiesClient.java b/src/main/java/com/squareup/square/giftcards/ActivitiesClient.java index 0ba35631..1cba3f95 100644 --- a/src/main/java/com/squareup/square/giftcards/ActivitiesClient.java +++ b/src/main/java/com/squareup/square/giftcards/ActivitiesClient.java @@ -38,6 +38,16 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + /** + * Lists gift card activities. By default, you get gift card activities for all + * gift cards in the seller's account. You can optionally specify query parameters to + * filter the list. For example, you can get a list of gift card activities for a gift card, + * for all gift cards in a specific region, or for activities within a time window. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + /** * Lists gift card activities. By default, you get gift card activities for all * gift cards in the seller's account. You can optionally specify query parameters to diff --git a/src/main/java/com/squareup/square/giftcards/AsyncActivitiesClient.java b/src/main/java/com/squareup/square/giftcards/AsyncActivitiesClient.java index 1469ce4e..74bd05ec 100644 --- a/src/main/java/com/squareup/square/giftcards/AsyncActivitiesClient.java +++ b/src/main/java/com/squareup/square/giftcards/AsyncActivitiesClient.java @@ -39,6 +39,16 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + /** + * Lists gift card activities. By default, you get gift card activities for all + * gift cards in the seller's account. You can optionally specify query parameters to + * filter the list. For example, you can get a list of gift card activities for a gift card, + * for all gift cards in a specific region, or for activities within a time window. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + /** * Lists gift card activities. By default, you get gift card activities for all * gift cards in the seller's account. You can optionally specify query parameters to diff --git a/src/main/java/com/squareup/square/giftcards/AsyncRawActivitiesClient.java b/src/main/java/com/squareup/square/giftcards/AsyncRawActivitiesClient.java index a8e21fb2..b14e3f7f 100644 --- a/src/main/java/com/squareup/square/giftcards/AsyncRawActivitiesClient.java +++ b/src/main/java/com/squareup/square/giftcards/AsyncRawActivitiesClient.java @@ -52,6 +52,17 @@ public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListActivitiesRequest.builder().build(), requestOptions); + } + /** * Lists gift card activities. By default, you get gift card activities for all * gift cards in the seller's account. You can optionally specify query parameters to diff --git a/src/main/java/com/squareup/square/giftcards/RawActivitiesClient.java b/src/main/java/com/squareup/square/giftcards/RawActivitiesClient.java index 82709420..792fd7e2 100644 --- a/src/main/java/com/squareup/square/giftcards/RawActivitiesClient.java +++ b/src/main/java/com/squareup/square/giftcards/RawActivitiesClient.java @@ -47,6 +47,16 @@ public SquareClientHttpResponse> list() { return list(ListActivitiesRequest.builder().build()); } + /** + * Lists gift card activities. By default, you get gift card activities for all + * gift cards in the seller's account. You can optionally specify query parameters to + * filter the list. For example, you can get a list of gift card activities for a gift card, + * for all gift cards in a specific region, or for activities within a time window. + */ + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListActivitiesRequest.builder().build(), requestOptions); + } + /** * Lists gift card activities. By default, you get gift card activities for all * gift cards in the seller's account. You can optionally specify query parameters to diff --git a/src/main/java/com/squareup/square/labor/AsyncBreakTypesClient.java b/src/main/java/com/squareup/square/labor/AsyncBreakTypesClient.java index 595cfe15..aebff076 100644 --- a/src/main/java/com/squareup/square/labor/AsyncBreakTypesClient.java +++ b/src/main/java/com/squareup/square/labor/AsyncBreakTypesClient.java @@ -42,6 +42,13 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + /** + * Returns a paginated list of BreakType instances for a business. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + /** * Returns a paginated list of BreakType instances for a business. */ diff --git a/src/main/java/com/squareup/square/labor/AsyncEmployeeWagesClient.java b/src/main/java/com/squareup/square/labor/AsyncEmployeeWagesClient.java index a7270067..e84190f3 100644 --- a/src/main/java/com/squareup/square/labor/AsyncEmployeeWagesClient.java +++ b/src/main/java/com/squareup/square/labor/AsyncEmployeeWagesClient.java @@ -36,6 +36,13 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + /** + * Returns a paginated list of EmployeeWage instances for a business. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + /** * Returns a paginated list of EmployeeWage instances for a business. */ diff --git a/src/main/java/com/squareup/square/labor/AsyncRawBreakTypesClient.java b/src/main/java/com/squareup/square/labor/AsyncRawBreakTypesClient.java index fcdcb2b6..2a72ec3b 100644 --- a/src/main/java/com/squareup/square/labor/AsyncRawBreakTypesClient.java +++ b/src/main/java/com/squareup/square/labor/AsyncRawBreakTypesClient.java @@ -55,6 +55,14 @@ public CompletableFuture> return list(ListBreakTypesRequest.builder().build()); } + /** + * Returns a paginated list of BreakType instances for a business. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListBreakTypesRequest.builder().build(), requestOptions); + } + /** * Returns a paginated list of BreakType instances for a business. */ diff --git a/src/main/java/com/squareup/square/labor/AsyncRawEmployeeWagesClient.java b/src/main/java/com/squareup/square/labor/AsyncRawEmployeeWagesClient.java index a922889a..1173646f 100644 --- a/src/main/java/com/squareup/square/labor/AsyncRawEmployeeWagesClient.java +++ b/src/main/java/com/squareup/square/labor/AsyncRawEmployeeWagesClient.java @@ -46,6 +46,14 @@ public CompletableFutureEmployeeWage instances for a business. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListEmployeeWagesRequest.builder().build(), requestOptions); + } + /** * Returns a paginated list of EmployeeWage instances for a business. */ diff --git a/src/main/java/com/squareup/square/labor/AsyncRawShiftsClient.java b/src/main/java/com/squareup/square/labor/AsyncRawShiftsClient.java index 95e51805..1f8e00b2 100644 --- a/src/main/java/com/squareup/square/labor/AsyncRawShiftsClient.java +++ b/src/main/java/com/squareup/square/labor/AsyncRawShiftsClient.java @@ -163,6 +163,29 @@ public CompletableFuture> search( return search(SearchShiftsRequest.builder().build()); } + /** + * Returns a paginated list of Shift records for a business. + * The list to be returned can be filtered by: + *

    + *
  • Location IDs
  • + *
  • Team member IDs
  • + *
  • Shift status (OPEN or CLOSED)
  • + *
  • Shift start
  • + *
  • Shift end
  • + *
  • Workday details
  • + *
+ *

The list can be sorted by:

+ *
    + *
  • START_AT
  • + *
  • END_AT
  • + *
  • CREATED_AT
  • + *
  • UPDATED_AT
  • + *
+ */ + public CompletableFuture> search(RequestOptions requestOptions) { + return search(SearchShiftsRequest.builder().build(), requestOptions); + } + /** * Returns a paginated list of Shift records for a business. * The list to be returned can be filtered by: diff --git a/src/main/java/com/squareup/square/labor/AsyncRawTeamMemberWagesClient.java b/src/main/java/com/squareup/square/labor/AsyncRawTeamMemberWagesClient.java index 03359b33..f64ec055 100644 --- a/src/main/java/com/squareup/square/labor/AsyncRawTeamMemberWagesClient.java +++ b/src/main/java/com/squareup/square/labor/AsyncRawTeamMemberWagesClient.java @@ -46,6 +46,14 @@ public CompletableFutureTeamMemberWage instances for a business. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListTeamMemberWagesRequest.builder().build(), requestOptions); + } + /** * Returns a paginated list of TeamMemberWage instances for a business. */ diff --git a/src/main/java/com/squareup/square/labor/AsyncRawWorkweekConfigsClient.java b/src/main/java/com/squareup/square/labor/AsyncRawWorkweekConfigsClient.java index 3c9a16b7..aedb5311 100644 --- a/src/main/java/com/squareup/square/labor/AsyncRawWorkweekConfigsClient.java +++ b/src/main/java/com/squareup/square/labor/AsyncRawWorkweekConfigsClient.java @@ -49,6 +49,14 @@ public CompletableFutureWorkweekConfig instances for a business. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListWorkweekConfigsRequest.builder().build(), requestOptions); + } + /** * Returns a list of WorkweekConfig instances for a business. */ diff --git a/src/main/java/com/squareup/square/labor/AsyncShiftsClient.java b/src/main/java/com/squareup/square/labor/AsyncShiftsClient.java index a76f660a..6c8e5d64 100644 --- a/src/main/java/com/squareup/square/labor/AsyncShiftsClient.java +++ b/src/main/java/com/squareup/square/labor/AsyncShiftsClient.java @@ -107,6 +107,29 @@ public CompletableFuture search() { return this.rawClient.search().thenApply(response -> response.body()); } + /** + * Returns a paginated list of Shift records for a business. + * The list to be returned can be filtered by: + *
    + *
  • Location IDs
  • + *
  • Team member IDs
  • + *
  • Shift status (OPEN or CLOSED)
  • + *
  • Shift start
  • + *
  • Shift end
  • + *
  • Workday details
  • + *
+ *

The list can be sorted by:

+ *
    + *
  • START_AT
  • + *
  • END_AT
  • + *
  • CREATED_AT
  • + *
  • UPDATED_AT
  • + *
+ */ + public CompletableFuture search(RequestOptions requestOptions) { + return this.rawClient.search(requestOptions).thenApply(response -> response.body()); + } + /** * Returns a paginated list of Shift records for a business. * The list to be returned can be filtered by: diff --git a/src/main/java/com/squareup/square/labor/AsyncTeamMemberWagesClient.java b/src/main/java/com/squareup/square/labor/AsyncTeamMemberWagesClient.java index 06a1248e..1aad8881 100644 --- a/src/main/java/com/squareup/square/labor/AsyncTeamMemberWagesClient.java +++ b/src/main/java/com/squareup/square/labor/AsyncTeamMemberWagesClient.java @@ -36,6 +36,13 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + /** + * Returns a paginated list of TeamMemberWage instances for a business. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + /** * Returns a paginated list of TeamMemberWage instances for a business. */ diff --git a/src/main/java/com/squareup/square/labor/AsyncWorkweekConfigsClient.java b/src/main/java/com/squareup/square/labor/AsyncWorkweekConfigsClient.java index c4ad4128..79dedbc1 100644 --- a/src/main/java/com/squareup/square/labor/AsyncWorkweekConfigsClient.java +++ b/src/main/java/com/squareup/square/labor/AsyncWorkweekConfigsClient.java @@ -36,6 +36,13 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + /** + * Returns a list of WorkweekConfig instances for a business. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + /** * Returns a list of WorkweekConfig instances for a business. */ diff --git a/src/main/java/com/squareup/square/labor/BreakTypesClient.java b/src/main/java/com/squareup/square/labor/BreakTypesClient.java index f356c31a..1583c1f8 100644 --- a/src/main/java/com/squareup/square/labor/BreakTypesClient.java +++ b/src/main/java/com/squareup/square/labor/BreakTypesClient.java @@ -41,6 +41,13 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + /** + * Returns a paginated list of BreakType instances for a business. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + /** * Returns a paginated list of BreakType instances for a business. */ diff --git a/src/main/java/com/squareup/square/labor/EmployeeWagesClient.java b/src/main/java/com/squareup/square/labor/EmployeeWagesClient.java index b20f3f04..e4476940 100644 --- a/src/main/java/com/squareup/square/labor/EmployeeWagesClient.java +++ b/src/main/java/com/squareup/square/labor/EmployeeWagesClient.java @@ -35,6 +35,13 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + /** + * Returns a paginated list of EmployeeWage instances for a business. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + /** * Returns a paginated list of EmployeeWage instances for a business. */ diff --git a/src/main/java/com/squareup/square/labor/RawBreakTypesClient.java b/src/main/java/com/squareup/square/labor/RawBreakTypesClient.java index e93e2a74..c4eeb41c 100644 --- a/src/main/java/com/squareup/square/labor/RawBreakTypesClient.java +++ b/src/main/java/com/squareup/square/labor/RawBreakTypesClient.java @@ -50,6 +50,13 @@ public SquareClientHttpResponse> list() { return list(ListBreakTypesRequest.builder().build()); } + /** + * Returns a paginated list of BreakType instances for a business. + */ + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListBreakTypesRequest.builder().build(), requestOptions); + } + /** * Returns a paginated list of BreakType instances for a business. */ diff --git a/src/main/java/com/squareup/square/labor/RawEmployeeWagesClient.java b/src/main/java/com/squareup/square/labor/RawEmployeeWagesClient.java index 8188ca44..e5e1699d 100644 --- a/src/main/java/com/squareup/square/labor/RawEmployeeWagesClient.java +++ b/src/main/java/com/squareup/square/labor/RawEmployeeWagesClient.java @@ -41,6 +41,13 @@ public SquareClientHttpResponse> list() { return list(ListEmployeeWagesRequest.builder().build()); } + /** + * Returns a paginated list of EmployeeWage instances for a business. + */ + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListEmployeeWagesRequest.builder().build(), requestOptions); + } + /** * Returns a paginated list of EmployeeWage instances for a business. */ diff --git a/src/main/java/com/squareup/square/labor/RawShiftsClient.java b/src/main/java/com/squareup/square/labor/RawShiftsClient.java index 383270e8..7c875aff 100644 --- a/src/main/java/com/squareup/square/labor/RawShiftsClient.java +++ b/src/main/java/com/squareup/square/labor/RawShiftsClient.java @@ -145,6 +145,29 @@ public SquareClientHttpResponse search() { return search(SearchShiftsRequest.builder().build()); } + /** + * Returns a paginated list of Shift records for a business. + * The list to be returned can be filtered by: + *
    + *
  • Location IDs
  • + *
  • Team member IDs
  • + *
  • Shift status (OPEN or CLOSED)
  • + *
  • Shift start
  • + *
  • Shift end
  • + *
  • Workday details
  • + *
+ *

The list can be sorted by:

+ *
    + *
  • START_AT
  • + *
  • END_AT
  • + *
  • CREATED_AT
  • + *
  • UPDATED_AT
  • + *
+ */ + public SquareClientHttpResponse search(RequestOptions requestOptions) { + return search(SearchShiftsRequest.builder().build(), requestOptions); + } + /** * Returns a paginated list of Shift records for a business. * The list to be returned can be filtered by: diff --git a/src/main/java/com/squareup/square/labor/RawTeamMemberWagesClient.java b/src/main/java/com/squareup/square/labor/RawTeamMemberWagesClient.java index 648b3ed4..4ddea344 100644 --- a/src/main/java/com/squareup/square/labor/RawTeamMemberWagesClient.java +++ b/src/main/java/com/squareup/square/labor/RawTeamMemberWagesClient.java @@ -41,6 +41,13 @@ public SquareClientHttpResponse> list() { return list(ListTeamMemberWagesRequest.builder().build()); } + /** + * Returns a paginated list of TeamMemberWage instances for a business. + */ + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListTeamMemberWagesRequest.builder().build(), requestOptions); + } + /** * Returns a paginated list of TeamMemberWage instances for a business. */ diff --git a/src/main/java/com/squareup/square/labor/RawWorkweekConfigsClient.java b/src/main/java/com/squareup/square/labor/RawWorkweekConfigsClient.java index 04847c13..31fb8b29 100644 --- a/src/main/java/com/squareup/square/labor/RawWorkweekConfigsClient.java +++ b/src/main/java/com/squareup/square/labor/RawWorkweekConfigsClient.java @@ -44,6 +44,13 @@ public SquareClientHttpResponse> list() { return list(ListWorkweekConfigsRequest.builder().build()); } + /** + * Returns a list of WorkweekConfig instances for a business. + */ + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListWorkweekConfigsRequest.builder().build(), requestOptions); + } + /** * Returns a list of WorkweekConfig instances for a business. */ diff --git a/src/main/java/com/squareup/square/labor/ShiftsClient.java b/src/main/java/com/squareup/square/labor/ShiftsClient.java index 23c8ee45..62a69a90 100644 --- a/src/main/java/com/squareup/square/labor/ShiftsClient.java +++ b/src/main/java/com/squareup/square/labor/ShiftsClient.java @@ -106,6 +106,29 @@ public SearchShiftsResponse search() { return this.rawClient.search().body(); } + /** + * Returns a paginated list of Shift records for a business. + * The list to be returned can be filtered by: + *
    + *
  • Location IDs
  • + *
  • Team member IDs
  • + *
  • Shift status (OPEN or CLOSED)
  • + *
  • Shift start
  • + *
  • Shift end
  • + *
  • Workday details
  • + *
+ *

The list can be sorted by:

+ *
    + *
  • START_AT
  • + *
  • END_AT
  • + *
  • CREATED_AT
  • + *
  • UPDATED_AT
  • + *
+ */ + public SearchShiftsResponse search(RequestOptions requestOptions) { + return this.rawClient.search(requestOptions).body(); + } + /** * Returns a paginated list of Shift records for a business. * The list to be returned can be filtered by: diff --git a/src/main/java/com/squareup/square/labor/TeamMemberWagesClient.java b/src/main/java/com/squareup/square/labor/TeamMemberWagesClient.java index 8098b64e..0cce11c5 100644 --- a/src/main/java/com/squareup/square/labor/TeamMemberWagesClient.java +++ b/src/main/java/com/squareup/square/labor/TeamMemberWagesClient.java @@ -35,6 +35,13 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + /** + * Returns a paginated list of TeamMemberWage instances for a business. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + /** * Returns a paginated list of TeamMemberWage instances for a business. */ diff --git a/src/main/java/com/squareup/square/labor/WorkweekConfigsClient.java b/src/main/java/com/squareup/square/labor/WorkweekConfigsClient.java index 6679242d..0eb84a57 100644 --- a/src/main/java/com/squareup/square/labor/WorkweekConfigsClient.java +++ b/src/main/java/com/squareup/square/labor/WorkweekConfigsClient.java @@ -35,6 +35,13 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + /** + * Returns a list of WorkweekConfig instances for a business. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + /** * Returns a list of WorkweekConfig instances for a business. */ diff --git a/src/main/java/com/squareup/square/locations/AsyncCustomAttributeDefinitionsClient.java b/src/main/java/com/squareup/square/locations/AsyncCustomAttributeDefinitionsClient.java index d9d13479..0c9abff2 100644 --- a/src/main/java/com/squareup/square/locations/AsyncCustomAttributeDefinitionsClient.java +++ b/src/main/java/com/squareup/square/locations/AsyncCustomAttributeDefinitionsClient.java @@ -45,6 +45,16 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + /** + * Lists the location-related custom attribute definitions that belong to a Square seller account. + * When all response pages are retrieved, the results include all custom attribute definitions + * that are visible to the requesting application, including those that are created by other + * applications and set to VISIBILITY_READ_ONLY or VISIBILITY_READ_WRITE_VALUES. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + /** * Lists the location-related custom attribute definitions that belong to a Square seller account. * When all response pages are retrieved, the results include all custom attribute definitions diff --git a/src/main/java/com/squareup/square/locations/AsyncRawCustomAttributeDefinitionsClient.java b/src/main/java/com/squareup/square/locations/AsyncRawCustomAttributeDefinitionsClient.java index bc39b243..543b2857 100644 --- a/src/main/java/com/squareup/square/locations/AsyncRawCustomAttributeDefinitionsClient.java +++ b/src/main/java/com/squareup/square/locations/AsyncRawCustomAttributeDefinitionsClient.java @@ -58,6 +58,17 @@ public CompletableFuturecustom attribute definitions that belong to a Square seller account. + * When all response pages are retrieved, the results include all custom attribute definitions + * that are visible to the requesting application, including those that are created by other + * applications and set to VISIBILITY_READ_ONLY or VISIBILITY_READ_WRITE_VALUES. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListCustomAttributeDefinitionsRequest.builder().build(), requestOptions); + } + /** * Lists the location-related custom attribute definitions that belong to a Square seller account. * When all response pages are retrieved, the results include all custom attribute definitions diff --git a/src/main/java/com/squareup/square/locations/CustomAttributeDefinitionsClient.java b/src/main/java/com/squareup/square/locations/CustomAttributeDefinitionsClient.java index 76575ad5..a70643af 100644 --- a/src/main/java/com/squareup/square/locations/CustomAttributeDefinitionsClient.java +++ b/src/main/java/com/squareup/square/locations/CustomAttributeDefinitionsClient.java @@ -44,6 +44,16 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + /** + * Lists the location-related custom attribute definitions that belong to a Square seller account. + * When all response pages are retrieved, the results include all custom attribute definitions + * that are visible to the requesting application, including those that are created by other + * applications and set to VISIBILITY_READ_ONLY or VISIBILITY_READ_WRITE_VALUES. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + /** * Lists the location-related custom attribute definitions that belong to a Square seller account. * When all response pages are retrieved, the results include all custom attribute definitions diff --git a/src/main/java/com/squareup/square/locations/RawCustomAttributeDefinitionsClient.java b/src/main/java/com/squareup/square/locations/RawCustomAttributeDefinitionsClient.java index 1d0c4170..4d77efba 100644 --- a/src/main/java/com/squareup/square/locations/RawCustomAttributeDefinitionsClient.java +++ b/src/main/java/com/squareup/square/locations/RawCustomAttributeDefinitionsClient.java @@ -53,6 +53,16 @@ public SquareClientHttpResponse> l return list(ListCustomAttributeDefinitionsRequest.builder().build()); } + /** + * Lists the location-related custom attribute definitions that belong to a Square seller account. + * When all response pages are retrieved, the results include all custom attribute definitions + * that are visible to the requesting application, including those that are created by other + * applications and set to VISIBILITY_READ_ONLY or VISIBILITY_READ_WRITE_VALUES. + */ + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListCustomAttributeDefinitionsRequest.builder().build(), requestOptions); + } + /** * Lists the location-related custom attribute definitions that belong to a Square seller account. * When all response pages are retrieved, the results include all custom attribute definitions diff --git a/src/main/java/com/squareup/square/loyalty/AccountsClient.java b/src/main/java/com/squareup/square/loyalty/AccountsClient.java index e74105fe..0cb38ac2 100644 --- a/src/main/java/com/squareup/square/loyalty/AccountsClient.java +++ b/src/main/java/com/squareup/square/loyalty/AccountsClient.java @@ -56,6 +56,15 @@ public SearchLoyaltyAccountsResponse search() { return this.rawClient.search().body(); } + /** + * Searches for loyalty accounts in a loyalty program. + *

You can search for a loyalty account using the phone number or customer ID associated with the account. To return all loyalty accounts, specify an empty query object or omit it entirely.

+ *

Search results are sorted by created_at in ascending order.

+ */ + public SearchLoyaltyAccountsResponse search(RequestOptions requestOptions) { + return this.rawClient.search(requestOptions).body(); + } + /** * Searches for loyalty accounts in a loyalty program. *

You can search for a loyalty account using the phone number or customer ID associated with the account. To return all loyalty accounts, specify an empty query object or omit it entirely.

diff --git a/src/main/java/com/squareup/square/loyalty/AsyncAccountsClient.java b/src/main/java/com/squareup/square/loyalty/AsyncAccountsClient.java index 02bac252..1759dc73 100644 --- a/src/main/java/com/squareup/square/loyalty/AsyncAccountsClient.java +++ b/src/main/java/com/squareup/square/loyalty/AsyncAccountsClient.java @@ -58,6 +58,15 @@ public CompletableFuture search() { return this.rawClient.search().thenApply(response -> response.body()); } + /** + * Searches for loyalty accounts in a loyalty program. + *

You can search for a loyalty account using the phone number or customer ID associated with the account. To return all loyalty accounts, specify an empty query object or omit it entirely.

+ *

Search results are sorted by created_at in ascending order.

+ */ + public CompletableFuture search(RequestOptions requestOptions) { + return this.rawClient.search(requestOptions).thenApply(response -> response.body()); + } + /** * Searches for loyalty accounts in a loyalty program. *

You can search for a loyalty account using the phone number or customer ID associated with the account. To return all loyalty accounts, specify an empty query object or omit it entirely.

diff --git a/src/main/java/com/squareup/square/loyalty/AsyncRawAccountsClient.java b/src/main/java/com/squareup/square/loyalty/AsyncRawAccountsClient.java index 65c791ef..29f63973 100644 --- a/src/main/java/com/squareup/square/loyalty/AsyncRawAccountsClient.java +++ b/src/main/java/com/squareup/square/loyalty/AsyncRawAccountsClient.java @@ -115,6 +115,16 @@ public CompletableFuture return search(SearchLoyaltyAccountsRequest.builder().build()); } + /** + * Searches for loyalty accounts in a loyalty program. + *

You can search for a loyalty account using the phone number or customer ID associated with the account. To return all loyalty accounts, specify an empty query object or omit it entirely.

+ *

Search results are sorted by created_at in ascending order.

+ */ + public CompletableFuture> search( + RequestOptions requestOptions) { + return search(SearchLoyaltyAccountsRequest.builder().build(), requestOptions); + } + /** * Searches for loyalty accounts in a loyalty program. *

You can search for a loyalty account using the phone number or customer ID associated with the account. To return all loyalty accounts, specify an empty query object or omit it entirely.

diff --git a/src/main/java/com/squareup/square/loyalty/AsyncRawRewardsClient.java b/src/main/java/com/squareup/square/loyalty/AsyncRawRewardsClient.java index 40311854..71804dcb 100644 --- a/src/main/java/com/squareup/square/loyalty/AsyncRawRewardsClient.java +++ b/src/main/java/com/squareup/square/loyalty/AsyncRawRewardsClient.java @@ -131,6 +131,18 @@ public CompletableFuture> return search(SearchLoyaltyRewardsRequest.builder().build()); } + /** + * Searches for loyalty rewards. This endpoint accepts a request with no query filters and returns results for all loyalty accounts. + * If you include a query object, loyalty_account_id is required and status is optional. + *

If you know a reward ID, use the + * RetrieveLoyaltyReward endpoint.

+ *

Search results are sorted by updated_at in descending order.

+ */ + public CompletableFuture> search( + RequestOptions requestOptions) { + return search(SearchLoyaltyRewardsRequest.builder().build(), requestOptions); + } + /** * Searches for loyalty rewards. This endpoint accepts a request with no query filters and returns results for all loyalty accounts. * If you include a query object, loyalty_account_id is required and status is optional. diff --git a/src/main/java/com/squareup/square/loyalty/AsyncRewardsClient.java b/src/main/java/com/squareup/square/loyalty/AsyncRewardsClient.java index 856c5c2c..03142b9c 100644 --- a/src/main/java/com/squareup/square/loyalty/AsyncRewardsClient.java +++ b/src/main/java/com/squareup/square/loyalty/AsyncRewardsClient.java @@ -74,6 +74,17 @@ public CompletableFuture search() { return this.rawClient.search().thenApply(response -> response.body()); } + /** + * Searches for loyalty rewards. This endpoint accepts a request with no query filters and returns results for all loyalty accounts. + * If you include a query object, loyalty_account_id is required and status is optional. + *

If you know a reward ID, use the + * RetrieveLoyaltyReward endpoint.

+ *

Search results are sorted by updated_at in descending order.

+ */ + public CompletableFuture search(RequestOptions requestOptions) { + return this.rawClient.search(requestOptions).thenApply(response -> response.body()); + } + /** * Searches for loyalty rewards. This endpoint accepts a request with no query filters and returns results for all loyalty accounts. * If you include a query object, loyalty_account_id is required and status is optional. diff --git a/src/main/java/com/squareup/square/loyalty/RawAccountsClient.java b/src/main/java/com/squareup/square/loyalty/RawAccountsClient.java index a96aa327..e9543e1e 100644 --- a/src/main/java/com/squareup/square/loyalty/RawAccountsClient.java +++ b/src/main/java/com/squareup/square/loyalty/RawAccountsClient.java @@ -96,6 +96,15 @@ public SquareClientHttpResponse search() { return search(SearchLoyaltyAccountsRequest.builder().build()); } + /** + * Searches for loyalty accounts in a loyalty program. + *

You can search for a loyalty account using the phone number or customer ID associated with the account. To return all loyalty accounts, specify an empty query object or omit it entirely.

+ *

Search results are sorted by created_at in ascending order.

+ */ + public SquareClientHttpResponse search(RequestOptions requestOptions) { + return search(SearchLoyaltyAccountsRequest.builder().build(), requestOptions); + } + /** * Searches for loyalty accounts in a loyalty program. *

You can search for a loyalty account using the phone number or customer ID associated with the account. To return all loyalty accounts, specify an empty query object or omit it entirely.

diff --git a/src/main/java/com/squareup/square/loyalty/RawRewardsClient.java b/src/main/java/com/squareup/square/loyalty/RawRewardsClient.java index ab724f8f..88e3fa03 100644 --- a/src/main/java/com/squareup/square/loyalty/RawRewardsClient.java +++ b/src/main/java/com/squareup/square/loyalty/RawRewardsClient.java @@ -112,6 +112,17 @@ public SquareClientHttpResponse search() { return search(SearchLoyaltyRewardsRequest.builder().build()); } + /** + * Searches for loyalty rewards. This endpoint accepts a request with no query filters and returns results for all loyalty accounts. + * If you include a query object, loyalty_account_id is required and status is optional. + *

If you know a reward ID, use the + * RetrieveLoyaltyReward endpoint.

+ *

Search results are sorted by updated_at in descending order.

+ */ + public SquareClientHttpResponse search(RequestOptions requestOptions) { + return search(SearchLoyaltyRewardsRequest.builder().build(), requestOptions); + } + /** * Searches for loyalty rewards. This endpoint accepts a request with no query filters and returns results for all loyalty accounts. * If you include a query object, loyalty_account_id is required and status is optional. diff --git a/src/main/java/com/squareup/square/loyalty/RewardsClient.java b/src/main/java/com/squareup/square/loyalty/RewardsClient.java index 00f7e5e0..80dca1f9 100644 --- a/src/main/java/com/squareup/square/loyalty/RewardsClient.java +++ b/src/main/java/com/squareup/square/loyalty/RewardsClient.java @@ -72,6 +72,17 @@ public SearchLoyaltyRewardsResponse search() { return this.rawClient.search().body(); } + /** + * Searches for loyalty rewards. This endpoint accepts a request with no query filters and returns results for all loyalty accounts. + * If you include a query object, loyalty_account_id is required and status is optional. + *

If you know a reward ID, use the + * RetrieveLoyaltyReward endpoint.

+ *

Search results are sorted by updated_at in descending order.

+ */ + public SearchLoyaltyRewardsResponse search(RequestOptions requestOptions) { + return this.rawClient.search(requestOptions).body(); + } + /** * Searches for loyalty rewards. This endpoint accepts a request with no query filters and returns results for all loyalty accounts. * If you include a query object, loyalty_account_id is required and status is optional. diff --git a/src/main/java/com/squareup/square/merchants/AsyncCustomAttributeDefinitionsClient.java b/src/main/java/com/squareup/square/merchants/AsyncCustomAttributeDefinitionsClient.java index 5ec8a4a0..e83185dd 100644 --- a/src/main/java/com/squareup/square/merchants/AsyncCustomAttributeDefinitionsClient.java +++ b/src/main/java/com/squareup/square/merchants/AsyncCustomAttributeDefinitionsClient.java @@ -45,6 +45,16 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + /** + * Lists the merchant-related custom attribute definitions that belong to a Square seller account. + * When all response pages are retrieved, the results include all custom attribute definitions + * that are visible to the requesting application, including those that are created by other + * applications and set to VISIBILITY_READ_ONLY or VISIBILITY_READ_WRITE_VALUES. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + /** * Lists the merchant-related custom attribute definitions that belong to a Square seller account. * When all response pages are retrieved, the results include all custom attribute definitions diff --git a/src/main/java/com/squareup/square/merchants/AsyncRawCustomAttributeDefinitionsClient.java b/src/main/java/com/squareup/square/merchants/AsyncRawCustomAttributeDefinitionsClient.java index f7ce62e1..7c8b5feb 100644 --- a/src/main/java/com/squareup/square/merchants/AsyncRawCustomAttributeDefinitionsClient.java +++ b/src/main/java/com/squareup/square/merchants/AsyncRawCustomAttributeDefinitionsClient.java @@ -58,6 +58,17 @@ public CompletableFuturecustom attribute definitions that belong to a Square seller account. + * When all response pages are retrieved, the results include all custom attribute definitions + * that are visible to the requesting application, including those that are created by other + * applications and set to VISIBILITY_READ_ONLY or VISIBILITY_READ_WRITE_VALUES. + */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListCustomAttributeDefinitionsRequest.builder().build(), requestOptions); + } + /** * Lists the merchant-related custom attribute definitions that belong to a Square seller account. * When all response pages are retrieved, the results include all custom attribute definitions diff --git a/src/main/java/com/squareup/square/merchants/CustomAttributeDefinitionsClient.java b/src/main/java/com/squareup/square/merchants/CustomAttributeDefinitionsClient.java index 388b31ad..2fb4ab5f 100644 --- a/src/main/java/com/squareup/square/merchants/CustomAttributeDefinitionsClient.java +++ b/src/main/java/com/squareup/square/merchants/CustomAttributeDefinitionsClient.java @@ -44,6 +44,16 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + /** + * Lists the merchant-related custom attribute definitions that belong to a Square seller account. + * When all response pages are retrieved, the results include all custom attribute definitions + * that are visible to the requesting application, including those that are created by other + * applications and set to VISIBILITY_READ_ONLY or VISIBILITY_READ_WRITE_VALUES. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + /** * Lists the merchant-related custom attribute definitions that belong to a Square seller account. * When all response pages are retrieved, the results include all custom attribute definitions diff --git a/src/main/java/com/squareup/square/merchants/RawCustomAttributeDefinitionsClient.java b/src/main/java/com/squareup/square/merchants/RawCustomAttributeDefinitionsClient.java index 74e2cfb5..0f08f807 100644 --- a/src/main/java/com/squareup/square/merchants/RawCustomAttributeDefinitionsClient.java +++ b/src/main/java/com/squareup/square/merchants/RawCustomAttributeDefinitionsClient.java @@ -53,6 +53,16 @@ public SquareClientHttpResponse> l return list(ListCustomAttributeDefinitionsRequest.builder().build()); } + /** + * Lists the merchant-related custom attribute definitions that belong to a Square seller account. + * When all response pages are retrieved, the results include all custom attribute definitions + * that are visible to the requesting application, including those that are created by other + * applications and set to VISIBILITY_READ_ONLY or VISIBILITY_READ_WRITE_VALUES. + */ + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListCustomAttributeDefinitionsRequest.builder().build(), requestOptions); + } + /** * Lists the merchant-related custom attribute definitions that belong to a Square seller account. * When all response pages are retrieved, the results include all custom attribute definitions diff --git a/src/main/java/com/squareup/square/orders/AsyncCustomAttributeDefinitionsClient.java b/src/main/java/com/squareup/square/orders/AsyncCustomAttributeDefinitionsClient.java index 55e0e2aa..30964324 100644 --- a/src/main/java/com/squareup/square/orders/AsyncCustomAttributeDefinitionsClient.java +++ b/src/main/java/com/squareup/square/orders/AsyncCustomAttributeDefinitionsClient.java @@ -46,6 +46,17 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + /** + * Lists the order-related custom attribute definitions that belong to a Square seller account. + *

When all response pages are retrieved, the results include all custom attribute definitions + * that are visible to the requesting application, including those that are created by other + * applications and set to VISIBILITY_READ_ONLY or VISIBILITY_READ_WRITE_VALUES. Note that + * seller-defined custom attributes (also known as custom fields) are always set to VISIBILITY_READ_WRITE_VALUES.

+ */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + /** * Lists the order-related custom attribute definitions that belong to a Square seller account. *

When all response pages are retrieved, the results include all custom attribute definitions diff --git a/src/main/java/com/squareup/square/orders/AsyncRawCustomAttributeDefinitionsClient.java b/src/main/java/com/squareup/square/orders/AsyncRawCustomAttributeDefinitionsClient.java index eeea4042..38dce564 100644 --- a/src/main/java/com/squareup/square/orders/AsyncRawCustomAttributeDefinitionsClient.java +++ b/src/main/java/com/squareup/square/orders/AsyncRawCustomAttributeDefinitionsClient.java @@ -58,6 +58,18 @@ public CompletableFuturecustom attribute definitions that belong to a Square seller account. + *

When all response pages are retrieved, the results include all custom attribute definitions + * that are visible to the requesting application, including those that are created by other + * applications and set to VISIBILITY_READ_ONLY or VISIBILITY_READ_WRITE_VALUES. Note that + * seller-defined custom attributes (also known as custom fields) are always set to VISIBILITY_READ_WRITE_VALUES.

+ */ + public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListCustomAttributeDefinitionsRequest.builder().build(), requestOptions); + } + /** * Lists the order-related custom attribute definitions that belong to a Square seller account. *

When all response pages are retrieved, the results include all custom attribute definitions diff --git a/src/main/java/com/squareup/square/orders/CustomAttributeDefinitionsClient.java b/src/main/java/com/squareup/square/orders/CustomAttributeDefinitionsClient.java index df8c01ab..b2342ff8 100644 --- a/src/main/java/com/squareup/square/orders/CustomAttributeDefinitionsClient.java +++ b/src/main/java/com/squareup/square/orders/CustomAttributeDefinitionsClient.java @@ -45,6 +45,17 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + /** + * Lists the order-related custom attribute definitions that belong to a Square seller account. + *

When all response pages are retrieved, the results include all custom attribute definitions + * that are visible to the requesting application, including those that are created by other + * applications and set to VISIBILITY_READ_ONLY or VISIBILITY_READ_WRITE_VALUES. Note that + * seller-defined custom attributes (also known as custom fields) are always set to VISIBILITY_READ_WRITE_VALUES.

+ */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + /** * Lists the order-related custom attribute definitions that belong to a Square seller account. *

When all response pages are retrieved, the results include all custom attribute definitions diff --git a/src/main/java/com/squareup/square/orders/RawCustomAttributeDefinitionsClient.java b/src/main/java/com/squareup/square/orders/RawCustomAttributeDefinitionsClient.java index 83eb4339..81154549 100644 --- a/src/main/java/com/squareup/square/orders/RawCustomAttributeDefinitionsClient.java +++ b/src/main/java/com/squareup/square/orders/RawCustomAttributeDefinitionsClient.java @@ -53,6 +53,17 @@ public SquareClientHttpResponse> l return list(ListCustomAttributeDefinitionsRequest.builder().build()); } + /** + * Lists the order-related custom attribute definitions that belong to a Square seller account. + *

When all response pages are retrieved, the results include all custom attribute definitions + * that are visible to the requesting application, including those that are created by other + * applications and set to VISIBILITY_READ_ONLY or VISIBILITY_READ_WRITE_VALUES. Note that + * seller-defined custom attributes (also known as custom fields) are always set to VISIBILITY_READ_WRITE_VALUES.

+ */ + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListCustomAttributeDefinitionsRequest.builder().build(), requestOptions); + } + /** * Lists the order-related custom attribute definitions that belong to a Square seller account. *

When all response pages are retrieved, the results include all custom attribute definitions diff --git a/src/main/java/com/squareup/square/terminal/ActionsClient.java b/src/main/java/com/squareup/square/terminal/ActionsClient.java index 3f481bbc..87724421 100644 --- a/src/main/java/com/squareup/square/terminal/ActionsClient.java +++ b/src/main/java/com/squareup/square/terminal/ActionsClient.java @@ -52,6 +52,13 @@ public SearchTerminalActionsResponse search() { return this.rawClient.search().body(); } + /** + * Retrieves a filtered list of Terminal action requests created by the account making the request. Terminal action requests are available for 30 days. + */ + public SearchTerminalActionsResponse search(RequestOptions requestOptions) { + return this.rawClient.search(requestOptions).body(); + } + /** * Retrieves a filtered list of Terminal action requests created by the account making the request. Terminal action requests are available for 30 days. */ diff --git a/src/main/java/com/squareup/square/terminal/AsyncActionsClient.java b/src/main/java/com/squareup/square/terminal/AsyncActionsClient.java index be6c7745..b029496e 100644 --- a/src/main/java/com/squareup/square/terminal/AsyncActionsClient.java +++ b/src/main/java/com/squareup/square/terminal/AsyncActionsClient.java @@ -54,6 +54,13 @@ public CompletableFuture search() { return this.rawClient.search().thenApply(response -> response.body()); } + /** + * Retrieves a filtered list of Terminal action requests created by the account making the request. Terminal action requests are available for 30 days. + */ + public CompletableFuture search(RequestOptions requestOptions) { + return this.rawClient.search(requestOptions).thenApply(response -> response.body()); + } + /** * Retrieves a filtered list of Terminal action requests created by the account making the request. Terminal action requests are available for 30 days. */ diff --git a/src/main/java/com/squareup/square/terminal/AsyncCheckoutsClient.java b/src/main/java/com/squareup/square/terminal/AsyncCheckoutsClient.java index 09974ec3..ce732a10 100644 --- a/src/main/java/com/squareup/square/terminal/AsyncCheckoutsClient.java +++ b/src/main/java/com/squareup/square/terminal/AsyncCheckoutsClient.java @@ -56,6 +56,13 @@ public CompletableFuture search() { return this.rawClient.search().thenApply(response -> response.body()); } + /** + * Returns a filtered list of Terminal checkout requests created by the application making the request. Only Terminal checkout requests created for the merchant scoped to the OAuth token are returned. Terminal checkout requests are available for 30 days. + */ + public CompletableFuture search(RequestOptions requestOptions) { + return this.rawClient.search(requestOptions).thenApply(response -> response.body()); + } + /** * Returns a filtered list of Terminal checkout requests created by the application making the request. Only Terminal checkout requests created for the merchant scoped to the OAuth token are returned. Terminal checkout requests are available for 30 days. */ diff --git a/src/main/java/com/squareup/square/terminal/AsyncRawActionsClient.java b/src/main/java/com/squareup/square/terminal/AsyncRawActionsClient.java index d48a5855..53430e83 100644 --- a/src/main/java/com/squareup/square/terminal/AsyncRawActionsClient.java +++ b/src/main/java/com/squareup/square/terminal/AsyncRawActionsClient.java @@ -111,6 +111,14 @@ public CompletableFuture return search(SearchTerminalActionsRequest.builder().build()); } + /** + * Retrieves a filtered list of Terminal action requests created by the account making the request. Terminal action requests are available for 30 days. + */ + public CompletableFuture> search( + RequestOptions requestOptions) { + return search(SearchTerminalActionsRequest.builder().build(), requestOptions); + } + /** * Retrieves a filtered list of Terminal action requests created by the account making the request. Terminal action requests are available for 30 days. */ diff --git a/src/main/java/com/squareup/square/terminal/AsyncRawCheckoutsClient.java b/src/main/java/com/squareup/square/terminal/AsyncRawCheckoutsClient.java index acc75dfd..84d973af 100644 --- a/src/main/java/com/squareup/square/terminal/AsyncRawCheckoutsClient.java +++ b/src/main/java/com/squareup/square/terminal/AsyncRawCheckoutsClient.java @@ -113,6 +113,14 @@ public CompletableFuture> search( + RequestOptions requestOptions) { + return search(SearchTerminalCheckoutsRequest.builder().build(), requestOptions); + } + /** * Returns a filtered list of Terminal checkout requests created by the application making the request. Only Terminal checkout requests created for the merchant scoped to the OAuth token are returned. Terminal checkout requests are available for 30 days. */ diff --git a/src/main/java/com/squareup/square/terminal/AsyncRawRefundsClient.java b/src/main/java/com/squareup/square/terminal/AsyncRawRefundsClient.java index 3d031fa0..0b90c60f 100644 --- a/src/main/java/com/squareup/square/terminal/AsyncRawRefundsClient.java +++ b/src/main/java/com/squareup/square/terminal/AsyncRawRefundsClient.java @@ -111,6 +111,14 @@ public CompletableFuture return search(SearchTerminalRefundsRequest.builder().build()); } + /** + * Retrieves a filtered list of Interac Terminal refund requests created by the seller making the request. Terminal refund requests are available for 30 days. + */ + public CompletableFuture> search( + RequestOptions requestOptions) { + return search(SearchTerminalRefundsRequest.builder().build(), requestOptions); + } + /** * Retrieves a filtered list of Interac Terminal refund requests created by the seller making the request. Terminal refund requests are available for 30 days. */ diff --git a/src/main/java/com/squareup/square/terminal/AsyncRefundsClient.java b/src/main/java/com/squareup/square/terminal/AsyncRefundsClient.java index 83aae4c5..0851f975 100644 --- a/src/main/java/com/squareup/square/terminal/AsyncRefundsClient.java +++ b/src/main/java/com/squareup/square/terminal/AsyncRefundsClient.java @@ -54,6 +54,13 @@ public CompletableFuture search() { return this.rawClient.search().thenApply(response -> response.body()); } + /** + * Retrieves a filtered list of Interac Terminal refund requests created by the seller making the request. Terminal refund requests are available for 30 days. + */ + public CompletableFuture search(RequestOptions requestOptions) { + return this.rawClient.search(requestOptions).thenApply(response -> response.body()); + } + /** * Retrieves a filtered list of Interac Terminal refund requests created by the seller making the request. Terminal refund requests are available for 30 days. */ diff --git a/src/main/java/com/squareup/square/terminal/CheckoutsClient.java b/src/main/java/com/squareup/square/terminal/CheckoutsClient.java index 28ca26d5..08ed1222 100644 --- a/src/main/java/com/squareup/square/terminal/CheckoutsClient.java +++ b/src/main/java/com/squareup/square/terminal/CheckoutsClient.java @@ -54,6 +54,13 @@ public SearchTerminalCheckoutsResponse search() { return this.rawClient.search().body(); } + /** + * Returns a filtered list of Terminal checkout requests created by the application making the request. Only Terminal checkout requests created for the merchant scoped to the OAuth token are returned. Terminal checkout requests are available for 30 days. + */ + public SearchTerminalCheckoutsResponse search(RequestOptions requestOptions) { + return this.rawClient.search(requestOptions).body(); + } + /** * Returns a filtered list of Terminal checkout requests created by the application making the request. Only Terminal checkout requests created for the merchant scoped to the OAuth token are returned. Terminal checkout requests are available for 30 days. */ diff --git a/src/main/java/com/squareup/square/terminal/RawActionsClient.java b/src/main/java/com/squareup/square/terminal/RawActionsClient.java index 5268ac08..4c61283c 100644 --- a/src/main/java/com/squareup/square/terminal/RawActionsClient.java +++ b/src/main/java/com/squareup/square/terminal/RawActionsClient.java @@ -92,6 +92,13 @@ public SquareClientHttpResponse search() { return search(SearchTerminalActionsRequest.builder().build()); } + /** + * Retrieves a filtered list of Terminal action requests created by the account making the request. Terminal action requests are available for 30 days. + */ + public SquareClientHttpResponse search(RequestOptions requestOptions) { + return search(SearchTerminalActionsRequest.builder().build(), requestOptions); + } + /** * Retrieves a filtered list of Terminal action requests created by the account making the request. Terminal action requests are available for 30 days. */ diff --git a/src/main/java/com/squareup/square/terminal/RawCheckoutsClient.java b/src/main/java/com/squareup/square/terminal/RawCheckoutsClient.java index 132c05c6..476615e3 100644 --- a/src/main/java/com/squareup/square/terminal/RawCheckoutsClient.java +++ b/src/main/java/com/squareup/square/terminal/RawCheckoutsClient.java @@ -94,6 +94,13 @@ public SquareClientHttpResponse search() { return search(SearchTerminalCheckoutsRequest.builder().build()); } + /** + * Returns a filtered list of Terminal checkout requests created by the application making the request. Only Terminal checkout requests created for the merchant scoped to the OAuth token are returned. Terminal checkout requests are available for 30 days. + */ + public SquareClientHttpResponse search(RequestOptions requestOptions) { + return search(SearchTerminalCheckoutsRequest.builder().build(), requestOptions); + } + /** * Returns a filtered list of Terminal checkout requests created by the application making the request. Only Terminal checkout requests created for the merchant scoped to the OAuth token are returned. Terminal checkout requests are available for 30 days. */ diff --git a/src/main/java/com/squareup/square/terminal/RawRefundsClient.java b/src/main/java/com/squareup/square/terminal/RawRefundsClient.java index 0ccafc2c..b34937c6 100644 --- a/src/main/java/com/squareup/square/terminal/RawRefundsClient.java +++ b/src/main/java/com/squareup/square/terminal/RawRefundsClient.java @@ -92,6 +92,13 @@ public SquareClientHttpResponse search() { return search(SearchTerminalRefundsRequest.builder().build()); } + /** + * Retrieves a filtered list of Interac Terminal refund requests created by the seller making the request. Terminal refund requests are available for 30 days. + */ + public SquareClientHttpResponse search(RequestOptions requestOptions) { + return search(SearchTerminalRefundsRequest.builder().build(), requestOptions); + } + /** * Retrieves a filtered list of Interac Terminal refund requests created by the seller making the request. Terminal refund requests are available for 30 days. */ diff --git a/src/main/java/com/squareup/square/terminal/RefundsClient.java b/src/main/java/com/squareup/square/terminal/RefundsClient.java index 2de218bf..d2d72780 100644 --- a/src/main/java/com/squareup/square/terminal/RefundsClient.java +++ b/src/main/java/com/squareup/square/terminal/RefundsClient.java @@ -52,6 +52,13 @@ public SearchTerminalRefundsResponse search() { return this.rawClient.search().body(); } + /** + * Retrieves a filtered list of Interac Terminal refund requests created by the seller making the request. Terminal refund requests are available for 30 days. + */ + public SearchTerminalRefundsResponse search(RequestOptions requestOptions) { + return this.rawClient.search(requestOptions).body(); + } + /** * Retrieves a filtered list of Interac Terminal refund requests created by the seller making the request. Terminal refund requests are available for 30 days. */ diff --git a/src/main/java/com/squareup/square/types/BankAccount.java b/src/main/java/com/squareup/square/types/BankAccount.java index beaaeaf9..8fd1fa13 100644 --- a/src/main/java/com/squareup/square/types/BankAccount.java +++ b/src/main/java/com/squareup/square/types/BankAccount.java @@ -58,6 +58,8 @@ public final class BankAccount { private final Optional bankName; + private final Optional customerId; + private final Map additionalProperties; private BankAccount( @@ -78,6 +80,7 @@ private BankAccount( Optional fingerprint, Optional version, Optional bankName, + Optional customerId, Map additionalProperties) { this.id = id; this.accountNumberSuffix = accountNumberSuffix; @@ -96,6 +99,7 @@ private BankAccount( this.fingerprint = fingerprint; this.version = version; this.bankName = bankName; + this.customerId = customerId; this.additionalProperties = additionalProperties; } @@ -268,6 +272,14 @@ public Optional getBankName() { return bankName; } + /** + * @return The ID of the customer who owns the bank account + */ + @JsonProperty("customer_id") + public Optional getCustomerId() { + return customerId; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("secondary_bank_identification_number") private Optional _getSecondaryBankIdentificationNumber() { @@ -332,7 +344,8 @@ private boolean equalTo(BankAccount other) { && debitable == other.debitable && fingerprint.equals(other.fingerprint) && version.equals(other.version) - && bankName.equals(other.bankName); + && bankName.equals(other.bankName) + && customerId.equals(other.customerId); } @java.lang.Override @@ -354,7 +367,8 @@ public int hashCode() { this.debitable, this.fingerprint, this.version, - this.bankName); + this.bankName, + this.customerId); } @java.lang.Override @@ -516,6 +530,13 @@ public interface _FinalStage { _FinalStage bankName(String bankName); _FinalStage bankName(Nullable bankName); + + /** + *

The ID of the customer who owns the bank account

+ */ + _FinalStage customerId(Optional customerId); + + _FinalStage customerId(String customerId); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -551,6 +572,8 @@ public static final class Builder private boolean debitable; + private Optional customerId = Optional.empty(); + private Optional bankName = Optional.empty(); private Optional version = Optional.empty(); @@ -589,6 +612,7 @@ public Builder from(BankAccount other) { fingerprint(other.getFingerprint()); version(other.getVersion()); bankName(other.getBankName()); + customerId(other.getCustomerId()); return this; } @@ -732,6 +756,26 @@ public _FinalStage debitable(boolean debitable) { return this; } + /** + *

The ID of the customer who owns the bank account

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customerId(String customerId) { + this.customerId = Optional.ofNullable(customerId); + return this; + } + + /** + *

The ID of the customer who owns the bank account

+ */ + @java.lang.Override + @JsonSetter(value = "customer_id", nulls = Nulls.SKIP) + public _FinalStage customerId(Optional customerId) { + this.customerId = customerId; + return this; + } + /** *

Read only. Name of actual financial institution. * For example "Bank of America".

@@ -1006,6 +1050,7 @@ public BankAccount build() { fingerprint, version, bankName, + customerId, additionalProperties); } } diff --git a/src/main/java/com/squareup/square/types/BuyNowPayLaterDetails.java b/src/main/java/com/squareup/square/types/BuyNowPayLaterDetails.java index 63233ef2..c6af0fbf 100644 --- a/src/main/java/com/squareup/square/types/BuyNowPayLaterDetails.java +++ b/src/main/java/com/squareup/square/types/BuyNowPayLaterDetails.java @@ -16,6 +16,7 @@ import com.squareup.square.core.NullableNonemptyFilter; import com.squareup.square.core.ObjectMappers; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -29,16 +30,20 @@ public final class BuyNowPayLaterDetails { private final Optional clearpayDetails; + private final Optional> errors; + private final Map additionalProperties; private BuyNowPayLaterDetails( Optional brand, Optional afterpayDetails, Optional clearpayDetails, + Optional> errors, Map additionalProperties) { this.brand = brand; this.afterpayDetails = afterpayDetails; this.clearpayDetails = clearpayDetails; + this.errors = errors; this.additionalProperties = additionalProperties; } @@ -72,6 +77,14 @@ public Optional getClearpayDetails() { return clearpayDetails; } + /** + * @return Information about errors encountered during the payment. + */ + @JsonProperty("errors") + public Optional> getErrors() { + return errors; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("brand") private Optional _getBrand() { @@ -92,12 +105,13 @@ public Map getAdditionalProperties() { private boolean equalTo(BuyNowPayLaterDetails other) { return brand.equals(other.brand) && afterpayDetails.equals(other.afterpayDetails) - && clearpayDetails.equals(other.clearpayDetails); + && clearpayDetails.equals(other.clearpayDetails) + && errors.equals(other.errors); } @java.lang.Override public int hashCode() { - return Objects.hash(this.brand, this.afterpayDetails, this.clearpayDetails); + return Objects.hash(this.brand, this.afterpayDetails, this.clearpayDetails, this.errors); } @java.lang.Override @@ -117,6 +131,8 @@ public static final class Builder { private Optional clearpayDetails = Optional.empty(); + private Optional> errors = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -126,6 +142,7 @@ public Builder from(BuyNowPayLaterDetails other) { brand(other.getBrand()); afterpayDetails(other.getAfterpayDetails()); clearpayDetails(other.getClearpayDetails()); + errors(other.getErrors()); return this; } @@ -185,8 +202,22 @@ public Builder clearpayDetails(ClearpayDetails clearpayDetails) { return this; } + /** + *

Information about errors encountered during the payment.

+ */ + @JsonSetter(value = "errors", nulls = Nulls.SKIP) + public Builder errors(Optional> errors) { + this.errors = errors; + return this; + } + + public Builder errors(List errors) { + this.errors = Optional.ofNullable(errors); + return this; + } + public BuyNowPayLaterDetails build() { - return new BuyNowPayLaterDetails(brand, afterpayDetails, clearpayDetails, additionalProperties); + return new BuyNowPayLaterDetails(brand, afterpayDetails, clearpayDetails, errors, additionalProperties); } } } diff --git a/src/main/java/com/squareup/square/types/Card.java b/src/main/java/com/squareup/square/types/Card.java index 02727210..fd5e10fc 100644 --- a/src/main/java/com/squareup/square/types/Card.java +++ b/src/main/java/com/squareup/square/types/Card.java @@ -53,6 +53,10 @@ public final class Card { private final Optional bin; + private final Optional createdAt; + + private final Optional disabledAt; + private final Optional version; private final Optional cardCoBrand; @@ -81,6 +85,8 @@ private Card( Optional cardType, Optional prepaidType, Optional bin, + Optional createdAt, + Optional disabledAt, Optional version, Optional cardCoBrand, Optional issuerAlert, @@ -102,6 +108,8 @@ private Card( this.cardType = cardType; this.prepaidType = prepaidType; this.bin = bin; + this.createdAt = createdAt; + this.disabledAt = disabledAt; this.version = version; this.cardCoBrand = cardCoBrand; this.issuerAlert = issuerAlert; @@ -256,6 +264,22 @@ public Optional getBin() { return bin; } + /** + * @return Timestamp for when the card object was created on Square’s servers. In RFC 3339 format, e.g., "2016-09-04T23:59:33.123Z". + */ + @JsonProperty("created_at") + public Optional getCreatedAt() { + return createdAt; + } + + /** + * @return Timestamp for when the card object was disabled on Square’s servers. In RFC 3339 format, e.g., "2016-09-04T23:59:33.123Z". + */ + @JsonProperty("disabled_at") + public Optional getDisabledAt() { + return disabledAt; + } + /** * @return Current version number of the card. Increments with each card update. Requests to update an * existing Card object will be rejected unless the version in the request matches the current @@ -364,6 +388,8 @@ private boolean equalTo(Card other) { && cardType.equals(other.cardType) && prepaidType.equals(other.prepaidType) && bin.equals(other.bin) + && createdAt.equals(other.createdAt) + && disabledAt.equals(other.disabledAt) && version.equals(other.version) && cardCoBrand.equals(other.cardCoBrand) && issuerAlert.equals(other.issuerAlert) @@ -389,6 +415,8 @@ public int hashCode() { this.cardType, this.prepaidType, this.bin, + this.createdAt, + this.disabledAt, this.version, this.cardCoBrand, this.issuerAlert, @@ -437,6 +465,10 @@ public static final class Builder { private Optional bin = Optional.empty(); + private Optional createdAt = Optional.empty(); + + private Optional disabledAt = Optional.empty(); + private Optional version = Optional.empty(); private Optional cardCoBrand = Optional.empty(); @@ -468,6 +500,8 @@ public Builder from(Card other) { cardType(other.getCardType()); prepaidType(other.getPrepaidType()); bin(other.getBin()); + createdAt(other.getCreatedAt()); + disabledAt(other.getDisabledAt()); version(other.getVersion()); cardCoBrand(other.getCardCoBrand()); issuerAlert(other.getIssuerAlert()); @@ -752,6 +786,34 @@ public Builder bin(String bin) { return this; } + /** + *

Timestamp for when the card object was created on Square’s servers. In RFC 3339 format, e.g., "2016-09-04T23:59:33.123Z".

+ */ + @JsonSetter(value = "created_at", nulls = Nulls.SKIP) + public Builder createdAt(Optional createdAt) { + this.createdAt = createdAt; + return this; + } + + public Builder createdAt(String createdAt) { + this.createdAt = Optional.ofNullable(createdAt); + return this; + } + + /** + *

Timestamp for when the card object was disabled on Square’s servers. In RFC 3339 format, e.g., "2016-09-04T23:59:33.123Z".

+ */ + @JsonSetter(value = "disabled_at", nulls = Nulls.SKIP) + public Builder disabledAt(Optional disabledAt) { + this.disabledAt = disabledAt; + return this; + } + + public Builder disabledAt(String disabledAt) { + this.disabledAt = Optional.ofNullable(disabledAt); + return this; + } + /** *

Current version number of the card. Increments with each card update. Requests to update an * existing Card object will be rejected unless the version in the request matches the current @@ -850,6 +912,8 @@ public Card build() { cardType, prepaidType, bin, + createdAt, + disabledAt, version, cardCoBrand, issuerAlert, diff --git a/src/main/java/com/squareup/square/types/CatalogItem.java b/src/main/java/com/squareup/square/types/CatalogItem.java index 19bcabc7..944bbf4f 100644 --- a/src/main/java/com/squareup/square/types/CatalogItem.java +++ b/src/main/java/com/squareup/square/types/CatalogItem.java @@ -36,6 +36,8 @@ public final class CatalogItem { private final Optional categoryId; + private final Optional buyerFacingName; + private final Optional> taxIds; private final Optional> modifierListInfo; @@ -62,6 +64,8 @@ public final class CatalogItem { private final Optional descriptionPlaintext; + private final Optional kitchenName; + private final Optional> channels; private final Optional isArchived; @@ -83,6 +87,7 @@ private CatalogItem( Optional labelColor, Optional isTaxable, Optional categoryId, + Optional buyerFacingName, Optional> taxIds, Optional> modifierListInfo, Optional> variations, @@ -96,6 +101,7 @@ private CatalogItem( Optional> categories, Optional descriptionHtml, Optional descriptionPlaintext, + Optional kitchenName, Optional> channels, Optional isArchived, Optional ecomSeoData, @@ -109,6 +115,7 @@ private CatalogItem( this.labelColor = labelColor; this.isTaxable = isTaxable; this.categoryId = categoryId; + this.buyerFacingName = buyerFacingName; this.taxIds = taxIds; this.modifierListInfo = modifierListInfo; this.variations = variations; @@ -122,6 +129,7 @@ private CatalogItem( this.categories = categories; this.descriptionHtml = descriptionHtml; this.descriptionPlaintext = descriptionPlaintext; + this.kitchenName = kitchenName; this.channels = channels; this.isArchived = isArchived; this.ecomSeoData = ecomSeoData; @@ -203,6 +211,17 @@ public Optional getCategoryId() { return categoryId; } + /** + * @return The override to a product name to display to users + */ + @JsonIgnore + public Optional getBuyerFacingName() { + if (buyerFacingName == null) { + return Optional.empty(); + } + return buyerFacingName; + } + /** * @return A set of IDs indicating the taxes enabled for * this item. When updating an item, any taxes listed here will be added to the item. @@ -384,6 +403,20 @@ public Optional getDescriptionPlaintext() { return descriptionPlaintext; } + /** + * @return (Optional) Name that the restaurant wants to display to their kitchen workers + * instead of the customer-facing name. + * e.g., customer name might be "Big John's Mega Burger" and the + * kitchen name is "12oz beef burger" + */ + @JsonIgnore + public Optional getKitchenName() { + if (kitchenName == null) { + return Optional.empty(); + } + return kitchenName; + } + /** * @return A list of IDs representing channels, such as a Square Online site, where the item can be made visible or available. * This field is read only and cannot be edited. @@ -478,6 +511,12 @@ private Optional _getCategoryId() { return categoryId; } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("buyer_facing_name") + private Optional _getBuyerFacingName() { + return buyerFacingName; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("tax_ids") private Optional> _getTaxIds() { @@ -544,6 +583,12 @@ private Optional _getDescriptionHtml() { return descriptionHtml; } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("kitchen_name") + private Optional _getKitchenName() { + return kitchenName; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("channels") private Optional> _getChannels() { @@ -580,6 +625,7 @@ private boolean equalTo(CatalogItem other) { && labelColor.equals(other.labelColor) && isTaxable.equals(other.isTaxable) && categoryId.equals(other.categoryId) + && buyerFacingName.equals(other.buyerFacingName) && taxIds.equals(other.taxIds) && modifierListInfo.equals(other.modifierListInfo) && variations.equals(other.variations) @@ -593,6 +639,7 @@ private boolean equalTo(CatalogItem other) { && categories.equals(other.categories) && descriptionHtml.equals(other.descriptionHtml) && descriptionPlaintext.equals(other.descriptionPlaintext) + && kitchenName.equals(other.kitchenName) && channels.equals(other.channels) && isArchived.equals(other.isArchived) && ecomSeoData.equals(other.ecomSeoData) @@ -610,6 +657,7 @@ public int hashCode() { this.labelColor, this.isTaxable, this.categoryId, + this.buyerFacingName, this.taxIds, this.modifierListInfo, this.variations, @@ -623,6 +671,7 @@ public int hashCode() { this.categories, this.descriptionHtml, this.descriptionPlaintext, + this.kitchenName, this.channels, this.isArchived, this.ecomSeoData, @@ -654,6 +703,8 @@ public static final class Builder { private Optional categoryId = Optional.empty(); + private Optional buyerFacingName = Optional.empty(); + private Optional> taxIds = Optional.empty(); private Optional> modifierListInfo = Optional.empty(); @@ -680,6 +731,8 @@ public static final class Builder { private Optional descriptionPlaintext = Optional.empty(); + private Optional kitchenName = Optional.empty(); + private Optional> channels = Optional.empty(); private Optional isArchived = Optional.empty(); @@ -704,6 +757,7 @@ public Builder from(CatalogItem other) { labelColor(other.getLabelColor()); isTaxable(other.getIsTaxable()); categoryId(other.getCategoryId()); + buyerFacingName(other.getBuyerFacingName()); taxIds(other.getTaxIds()); modifierListInfo(other.getModifierListInfo()); variations(other.getVariations()); @@ -717,6 +771,7 @@ public Builder from(CatalogItem other) { categories(other.getCategories()); descriptionHtml(other.getDescriptionHtml()); descriptionPlaintext(other.getDescriptionPlaintext()); + kitchenName(other.getKitchenName()); channels(other.getChannels()); isArchived(other.getIsArchived()); ecomSeoData(other.getEcomSeoData()); @@ -882,6 +937,31 @@ public Builder categoryId(Nullable categoryId) { return this; } + /** + *

The override to a product name to display to users

+ */ + @JsonSetter(value = "buyer_facing_name", nulls = Nulls.SKIP) + public Builder buyerFacingName(Optional buyerFacingName) { + this.buyerFacingName = buyerFacingName; + return this; + } + + public Builder buyerFacingName(String buyerFacingName) { + this.buyerFacingName = Optional.ofNullable(buyerFacingName); + return this; + } + + public Builder buyerFacingName(Nullable buyerFacingName) { + if (buyerFacingName.isNull()) { + this.buyerFacingName = null; + } else if (buyerFacingName.isEmpty()) { + this.buyerFacingName = Optional.empty(); + } else { + this.buyerFacingName = Optional.of(buyerFacingName.get()); + } + return this; + } + /** *

A set of IDs indicating the taxes enabled for * this item. When updating an item, any taxes listed here will be added to the item. @@ -1229,6 +1309,34 @@ public Builder descriptionPlaintext(String descriptionPlaintext) { return this; } + /** + *

(Optional) Name that the restaurant wants to display to their kitchen workers + * instead of the customer-facing name. + * e.g., customer name might be "Big John's Mega Burger" and the + * kitchen name is "12oz beef burger"

+ */ + @JsonSetter(value = "kitchen_name", nulls = Nulls.SKIP) + public Builder kitchenName(Optional kitchenName) { + this.kitchenName = kitchenName; + return this; + } + + public Builder kitchenName(String kitchenName) { + this.kitchenName = Optional.ofNullable(kitchenName); + return this; + } + + public Builder kitchenName(Nullable kitchenName) { + if (kitchenName.isNull()) { + this.kitchenName = null; + } else if (kitchenName.isEmpty()) { + this.kitchenName = Optional.empty(); + } else { + this.kitchenName = Optional.of(kitchenName.get()); + } + return this; + } + /** *

A list of IDs representing channels, such as a Square Online site, where the item can be made visible or available. * This field is read only and cannot be edited.

@@ -1355,6 +1463,7 @@ public CatalogItem build() { labelColor, isTaxable, categoryId, + buyerFacingName, taxIds, modifierListInfo, variations, @@ -1368,6 +1477,7 @@ public CatalogItem build() { categories, descriptionHtml, descriptionPlaintext, + kitchenName, channels, isArchived, ecomSeoData, diff --git a/src/main/java/com/squareup/square/types/CatalogItemModifierListInfo.java b/src/main/java/com/squareup/square/types/CatalogItemModifierListInfo.java index 7f10816f..bc5255e8 100644 --- a/src/main/java/com/squareup/square/types/CatalogItemModifierListInfo.java +++ b/src/main/java/com/squareup/square/types/CatalogItemModifierListInfo.java @@ -37,11 +37,11 @@ public final class CatalogItemModifierListInfo { private final Optional ordinal; - private final Optional allowQuantities; + private final Optional allowQuantities; - private final Optional isConversational; + private final Optional isConversational; - private final Optional hiddenFromCustomerOverride; + private final Optional hiddenFromCustomerOverride; private final Map additionalProperties; @@ -52,9 +52,9 @@ private CatalogItemModifierListInfo( Optional maxSelectedModifiers, Optional enabled, Optional ordinal, - Optional allowQuantities, - Optional isConversational, - Optional hiddenFromCustomerOverride, + Optional allowQuantities, + Optional isConversational, + Optional hiddenFromCustomerOverride, Map additionalProperties) { this.modifierListId = modifierListId; this.modifierOverrides = modifierOverrides; @@ -148,18 +148,47 @@ public Optional getOrdinal() { return ordinal; } + /** + * @return Controls whether multiple quantities of the same modifier can be selected for this item. + *
    + *
  • YES means that every modifier in the CatalogModifierList can have multiple quantities + * selected for this item.
  • + *
  • NO means that each modifier in the CatalogModifierList can be selected only once for this item.
  • + *
  • NOT_SET means that the allow_quantities setting on the CatalogModifierList is obeyed. + * See CatalogModifierToggleOverrideType for possible values
  • + *
+ */ @JsonProperty("allow_quantities") - public Optional getAllowQuantities() { + public Optional getAllowQuantities() { return allowQuantities; } + /** + * @return Controls whether conversational mode is enabled for modifiers on this item. + *
    + *
  • YES means conversational mode is enabled for every modifier in the CatalogModifierList.
  • + *
  • NO means that conversational mode is not enabled for any modifier in the CatalogModifierList.
  • + *
  • NOT_SET means that conversational mode is not enabled for any modifier in the CatalogModifierList. + * See CatalogModifierToggleOverrideType for possible values
  • + *
+ */ @JsonProperty("is_conversational") - public Optional getIsConversational() { + public Optional getIsConversational() { return isConversational; } + /** + * @return Controls whether all modifiers for this item are hidden from customer receipts. + *
    + *
  • YES means that all modifiers in the CatalogModifierList are hidden from customer + * receipts for this item.
  • + *
  • NO means that all modifiers in the CatalogModifierList are visible on customer receipts for this item.
  • + *
  • NOT_SET means that the hidden_from_customer setting on the CatalogModifierList is obeyed. + * See CatalogModifierToggleOverrideType for possible values
  • + *
+ */ @JsonProperty("hidden_from_customer_override") - public Optional getHiddenFromCustomerOverride() { + public Optional getHiddenFromCustomerOverride() { return hiddenFromCustomerOverride; } @@ -313,28 +342,57 @@ public interface _FinalStage { _FinalStage ordinal(Nullable ordinal); - _FinalStage allowQuantities(Optional allowQuantities); + /** + *

Controls whether multiple quantities of the same modifier can be selected for this item.

+ *
    + *
  • YES means that every modifier in the CatalogModifierList can have multiple quantities + * selected for this item.
  • + *
  • NO means that each modifier in the CatalogModifierList can be selected only once for this item.
  • + *
  • NOT_SET means that the allow_quantities setting on the CatalogModifierList is obeyed. + * See CatalogModifierToggleOverrideType for possible values
  • + *
+ */ + _FinalStage allowQuantities(Optional allowQuantities); - _FinalStage allowQuantities(Object allowQuantities); + _FinalStage allowQuantities(CatalogModifierToggleOverrideType allowQuantities); - _FinalStage isConversational(Optional isConversational); + /** + *

Controls whether conversational mode is enabled for modifiers on this item.

+ *
    + *
  • YES means conversational mode is enabled for every modifier in the CatalogModifierList.
  • + *
  • NO means that conversational mode is not enabled for any modifier in the CatalogModifierList.
  • + *
  • NOT_SET means that conversational mode is not enabled for any modifier in the CatalogModifierList. + * See CatalogModifierToggleOverrideType for possible values
  • + *
+ */ + _FinalStage isConversational(Optional isConversational); - _FinalStage isConversational(Object isConversational); + _FinalStage isConversational(CatalogModifierToggleOverrideType isConversational); - _FinalStage hiddenFromCustomerOverride(Optional hiddenFromCustomerOverride); + /** + *

Controls whether all modifiers for this item are hidden from customer receipts.

+ *
    + *
  • YES means that all modifiers in the CatalogModifierList are hidden from customer + * receipts for this item.
  • + *
  • NO means that all modifiers in the CatalogModifierList are visible on customer receipts for this item.
  • + *
  • NOT_SET means that the hidden_from_customer setting on the CatalogModifierList is obeyed. + * See CatalogModifierToggleOverrideType for possible values
  • + *
+ */ + _FinalStage hiddenFromCustomerOverride(Optional hiddenFromCustomerOverride); - _FinalStage hiddenFromCustomerOverride(Object hiddenFromCustomerOverride); + _FinalStage hiddenFromCustomerOverride(CatalogModifierToggleOverrideType hiddenFromCustomerOverride); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements ModifierListIdStage, _FinalStage { private String modifierListId; - private Optional hiddenFromCustomerOverride = Optional.empty(); + private Optional hiddenFromCustomerOverride = Optional.empty(); - private Optional isConversational = Optional.empty(); + private Optional isConversational = Optional.empty(); - private Optional allowQuantities = Optional.empty(); + private Optional allowQuantities = Optional.empty(); private Optional ordinal = Optional.empty(); @@ -377,41 +435,103 @@ public _FinalStage modifierListId(@NotNull String modifierListId) { return this; } + /** + *

Controls whether all modifiers for this item are hidden from customer receipts.

+ *
    + *
  • YES means that all modifiers in the CatalogModifierList are hidden from customer + * receipts for this item.
  • + *
  • NO means that all modifiers in the CatalogModifierList are visible on customer receipts for this item.
  • + *
  • NOT_SET means that the hidden_from_customer setting on the CatalogModifierList is obeyed. + * See CatalogModifierToggleOverrideType for possible values
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ @java.lang.Override - public _FinalStage hiddenFromCustomerOverride(Object hiddenFromCustomerOverride) { + public _FinalStage hiddenFromCustomerOverride(CatalogModifierToggleOverrideType hiddenFromCustomerOverride) { this.hiddenFromCustomerOverride = Optional.ofNullable(hiddenFromCustomerOverride); return this; } + /** + *

Controls whether all modifiers for this item are hidden from customer receipts.

+ *
    + *
  • YES means that all modifiers in the CatalogModifierList are hidden from customer + * receipts for this item.
  • + *
  • NO means that all modifiers in the CatalogModifierList are visible on customer receipts for this item.
  • + *
  • NOT_SET means that the hidden_from_customer setting on the CatalogModifierList is obeyed. + * See CatalogModifierToggleOverrideType for possible values
  • + *
+ */ @java.lang.Override @JsonSetter(value = "hidden_from_customer_override", nulls = Nulls.SKIP) - public _FinalStage hiddenFromCustomerOverride(Optional hiddenFromCustomerOverride) { + public _FinalStage hiddenFromCustomerOverride( + Optional hiddenFromCustomerOverride) { this.hiddenFromCustomerOverride = hiddenFromCustomerOverride; return this; } + /** + *

Controls whether conversational mode is enabled for modifiers on this item.

+ *
    + *
  • YES means conversational mode is enabled for every modifier in the CatalogModifierList.
  • + *
  • NO means that conversational mode is not enabled for any modifier in the CatalogModifierList.
  • + *
  • NOT_SET means that conversational mode is not enabled for any modifier in the CatalogModifierList. + * See CatalogModifierToggleOverrideType for possible values
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ @java.lang.Override - public _FinalStage isConversational(Object isConversational) { + public _FinalStage isConversational(CatalogModifierToggleOverrideType isConversational) { this.isConversational = Optional.ofNullable(isConversational); return this; } + /** + *

Controls whether conversational mode is enabled for modifiers on this item.

+ *
    + *
  • YES means conversational mode is enabled for every modifier in the CatalogModifierList.
  • + *
  • NO means that conversational mode is not enabled for any modifier in the CatalogModifierList.
  • + *
  • NOT_SET means that conversational mode is not enabled for any modifier in the CatalogModifierList. + * See CatalogModifierToggleOverrideType for possible values
  • + *
+ */ @java.lang.Override @JsonSetter(value = "is_conversational", nulls = Nulls.SKIP) - public _FinalStage isConversational(Optional isConversational) { + public _FinalStage isConversational(Optional isConversational) { this.isConversational = isConversational; return this; } + /** + *

Controls whether multiple quantities of the same modifier can be selected for this item.

+ *
    + *
  • YES means that every modifier in the CatalogModifierList can have multiple quantities + * selected for this item.
  • + *
  • NO means that each modifier in the CatalogModifierList can be selected only once for this item.
  • + *
  • NOT_SET means that the allow_quantities setting on the CatalogModifierList is obeyed. + * See CatalogModifierToggleOverrideType for possible values
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ @java.lang.Override - public _FinalStage allowQuantities(Object allowQuantities) { + public _FinalStage allowQuantities(CatalogModifierToggleOverrideType allowQuantities) { this.allowQuantities = Optional.ofNullable(allowQuantities); return this; } + /** + *

Controls whether multiple quantities of the same modifier can be selected for this item.

+ *
    + *
  • YES means that every modifier in the CatalogModifierList can have multiple quantities + * selected for this item.
  • + *
  • NO means that each modifier in the CatalogModifierList can be selected only once for this item.
  • + *
  • NOT_SET means that the allow_quantities setting on the CatalogModifierList is obeyed. + * See CatalogModifierToggleOverrideType for possible values
  • + *
+ */ @java.lang.Override @JsonSetter(value = "allow_quantities", nulls = Nulls.SKIP) - public _FinalStage allowQuantities(Optional allowQuantities) { + public _FinalStage allowQuantities(Optional allowQuantities) { this.allowQuantities = allowQuantities; return this; } diff --git a/src/main/java/com/squareup/square/types/CatalogItemVariation.java b/src/main/java/com/squareup/square/types/CatalogItemVariation.java index dede8428..42d3ea43 100644 --- a/src/main/java/com/squareup/square/types/CatalogItemVariation.java +++ b/src/main/java/com/squareup/square/types/CatalogItemVariation.java @@ -66,6 +66,8 @@ public final class CatalogItemVariation { private final Optional stockableConversion; + private final Optional kitchenName; + private final Map additionalProperties; private CatalogItemVariation( @@ -90,6 +92,7 @@ private CatalogItemVariation( Optional> imageIds, Optional> teamMemberIds, Optional stockableConversion, + Optional kitchenName, Map additionalProperties) { this.itemId = itemId; this.name = name; @@ -112,6 +115,7 @@ private CatalogItemVariation( this.imageIds = imageIds; this.teamMemberIds = teamMemberIds; this.stockableConversion = stockableConversion; + this.kitchenName = kitchenName; this.additionalProperties = additionalProperties; } @@ -363,6 +367,20 @@ public Optional getStockableConversion() { return stockableConversion; } + /** + * @return (Optional) Name that the restaurant wants to display to their kitchen workers + * instead of the customer-facing name. + * e.g., customer name might be "Mega-Jumbo Triplesized" and the + * kitchen name is "Large container" + */ + @JsonIgnore + public Optional getKitchenName() { + if (kitchenName == null) { + return Optional.empty(); + } + return kitchenName; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("item_id") private Optional _getItemId() { @@ -459,6 +477,12 @@ private Optional> _getTeamMemberIds() { return teamMemberIds; } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("kitchen_name") + private Optional _getKitchenName() { + return kitchenName; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -491,7 +515,8 @@ private boolean equalTo(CatalogItemVariation other) { && stockable.equals(other.stockable) && imageIds.equals(other.imageIds) && teamMemberIds.equals(other.teamMemberIds) - && stockableConversion.equals(other.stockableConversion); + && stockableConversion.equals(other.stockableConversion) + && kitchenName.equals(other.kitchenName); } @java.lang.Override @@ -517,7 +542,8 @@ public int hashCode() { this.stockable, this.imageIds, this.teamMemberIds, - this.stockableConversion); + this.stockableConversion, + this.kitchenName); } @java.lang.Override @@ -573,6 +599,8 @@ public static final class Builder { private Optional stockableConversion = Optional.empty(); + private Optional kitchenName = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -600,6 +628,7 @@ public Builder from(CatalogItemVariation other) { imageIds(other.getImageIds()); teamMemberIds(other.getTeamMemberIds()); stockableConversion(other.getStockableConversion()); + kitchenName(other.getKitchenName()); return this; } @@ -1105,6 +1134,34 @@ public Builder stockableConversion(CatalogStockConversion stockableConversion) { return this; } + /** + *

(Optional) Name that the restaurant wants to display to their kitchen workers + * instead of the customer-facing name. + * e.g., customer name might be "Mega-Jumbo Triplesized" and the + * kitchen name is "Large container"

+ */ + @JsonSetter(value = "kitchen_name", nulls = Nulls.SKIP) + public Builder kitchenName(Optional kitchenName) { + this.kitchenName = kitchenName; + return this; + } + + public Builder kitchenName(String kitchenName) { + this.kitchenName = Optional.ofNullable(kitchenName); + return this; + } + + public Builder kitchenName(Nullable kitchenName) { + if (kitchenName.isNull()) { + this.kitchenName = null; + } else if (kitchenName.isEmpty()) { + this.kitchenName = Optional.empty(); + } else { + this.kitchenName = Optional.of(kitchenName.get()); + } + return this; + } + public CatalogItemVariation build() { return new CatalogItemVariation( itemId, @@ -1128,6 +1185,7 @@ public CatalogItemVariation build() { imageIds, teamMemberIds, stockableConversion, + kitchenName, additionalProperties); } } diff --git a/src/main/java/com/squareup/square/types/CatalogModifier.java b/src/main/java/com/squareup/square/types/CatalogModifier.java index e8cd1e3e..9bbaca28 100644 --- a/src/main/java/com/squareup/square/types/CatalogModifier.java +++ b/src/main/java/com/squareup/square/types/CatalogModifier.java @@ -36,6 +36,8 @@ public final class CatalogModifier { private final Optional> locationOverrides; + private final Optional kitchenName; + private final Optional imageId; private final Optional hiddenOnline; @@ -49,6 +51,7 @@ private CatalogModifier( Optional ordinal, Optional modifierListId, Optional> locationOverrides, + Optional kitchenName, Optional imageId, Optional hiddenOnline, Map additionalProperties) { @@ -58,6 +61,7 @@ private CatalogModifier( this.ordinal = ordinal; this.modifierListId = modifierListId; this.locationOverrides = locationOverrides; + this.kitchenName = kitchenName; this.imageId = imageId; this.hiddenOnline = hiddenOnline; this.additionalProperties = additionalProperties; @@ -127,6 +131,20 @@ public Optional> getLocationOverrides() { return locationOverrides; } + /** + * @return (Optional) Name that the restaurant wants to display to their kitchen workers + * instead of the customer-facing name. + * e.g., customer name might be "Double Baconize" and the + * kitchen name is "Add 2x bacon" + */ + @JsonIgnore + public Optional getKitchenName() { + if (kitchenName == null) { + return Optional.empty(); + } + return kitchenName; + } + /** * @return The ID of the image associated with this CatalogModifier instance. * Currently this image is not displayed by Square, but is free to be displayed in 3rd party applications. @@ -180,6 +198,12 @@ private Optional> _getLocationOverrides() { return locationOverrides; } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("kitchen_name") + private Optional _getKitchenName() { + return kitchenName; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("image_id") private Optional _getImageId() { @@ -210,6 +234,7 @@ private boolean equalTo(CatalogModifier other) { && ordinal.equals(other.ordinal) && modifierListId.equals(other.modifierListId) && locationOverrides.equals(other.locationOverrides) + && kitchenName.equals(other.kitchenName) && imageId.equals(other.imageId) && hiddenOnline.equals(other.hiddenOnline); } @@ -223,6 +248,7 @@ public int hashCode() { this.ordinal, this.modifierListId, this.locationOverrides, + this.kitchenName, this.imageId, this.hiddenOnline); } @@ -250,6 +276,8 @@ public static final class Builder { private Optional> locationOverrides = Optional.empty(); + private Optional kitchenName = Optional.empty(); + private Optional imageId = Optional.empty(); private Optional hiddenOnline = Optional.empty(); @@ -266,6 +294,7 @@ public Builder from(CatalogModifier other) { ordinal(other.getOrdinal()); modifierListId(other.getModifierListId()); locationOverrides(other.getLocationOverrides()); + kitchenName(other.getKitchenName()); imageId(other.getImageId()); hiddenOnline(other.getHiddenOnline()); return this; @@ -411,6 +440,34 @@ public Builder locationOverrides(Nullable> locat return this; } + /** + *

(Optional) Name that the restaurant wants to display to their kitchen workers + * instead of the customer-facing name. + * e.g., customer name might be "Double Baconize" and the + * kitchen name is "Add 2x bacon"

+ */ + @JsonSetter(value = "kitchen_name", nulls = Nulls.SKIP) + public Builder kitchenName(Optional kitchenName) { + this.kitchenName = kitchenName; + return this; + } + + public Builder kitchenName(String kitchenName) { + this.kitchenName = Optional.ofNullable(kitchenName); + return this; + } + + public Builder kitchenName(Nullable kitchenName) { + if (kitchenName.isNull()) { + this.kitchenName = null; + } else if (kitchenName.isEmpty()) { + this.kitchenName = Optional.empty(); + } else { + this.kitchenName = Optional.of(kitchenName.get()); + } + return this; + } + /** *

The ID of the image associated with this CatalogModifier instance. * Currently this image is not displayed by Square, but is free to be displayed in 3rd party applications.

@@ -470,6 +527,7 @@ public CatalogModifier build() { ordinal, modifierListId, locationOverrides, + kitchenName, imageId, hiddenOnline, additionalProperties); diff --git a/src/main/java/com/squareup/square/types/CatalogModifierOverride.java b/src/main/java/com/squareup/square/types/CatalogModifierOverride.java index cc1f731a..58779af7 100644 --- a/src/main/java/com/squareup/square/types/CatalogModifierOverride.java +++ b/src/main/java/com/squareup/square/types/CatalogModifierOverride.java @@ -28,17 +28,17 @@ public final class CatalogModifierOverride { private final Optional onByDefault; - private final Optional hiddenOnlineOverride; + private final Optional hiddenOnlineOverride; - private final Optional onByDefaultOverride; + private final Optional onByDefaultOverride; private final Map additionalProperties; private CatalogModifierOverride( String modifierId, Optional onByDefault, - Optional hiddenOnlineOverride, - Optional onByDefaultOverride, + Optional hiddenOnlineOverride, + Optional onByDefaultOverride, Map additionalProperties) { this.modifierId = modifierId; this.onByDefault = onByDefault; @@ -66,13 +66,27 @@ public Optional getOnByDefault() { return onByDefault; } + /** + * @return If YES, this setting overrides the hidden_online setting on the CatalogModifier object, + * and the modifier is always hidden from online sales channels. + * If NO, the modifier is not hidden. It is always visible in online sales channels for this catalog item. + * NOT_SET means the hidden_online setting on the CatalogModifier object is obeyed. + * See CatalogModifierToggleOverrideType for possible values + */ @JsonProperty("hidden_online_override") - public Optional getHiddenOnlineOverride() { + public Optional getHiddenOnlineOverride() { return hiddenOnlineOverride; } + /** + * @return If YES, this setting overrides the on_by_default setting on the CatalogModifier object, + * and the modifier is always selected by default for the catalog item. + *

If NO, the modifier is not selected by default for this catalog item. + * NOT_SET means the on_by_default setting on the CatalogModifier object is obeyed. + * See CatalogModifierToggleOverrideType for possible values

+ */ @JsonProperty("on_by_default_override") - public Optional getOnByDefaultOverride() { + public Optional getOnByDefaultOverride() { return onByDefaultOverride; } @@ -135,22 +149,36 @@ public interface _FinalStage { _FinalStage onByDefault(Nullable onByDefault); - _FinalStage hiddenOnlineOverride(Optional hiddenOnlineOverride); + /** + *

If YES, this setting overrides the hidden_online setting on the CatalogModifier object, + * and the modifier is always hidden from online sales channels. + * If NO, the modifier is not hidden. It is always visible in online sales channels for this catalog item. + * NOT_SET means the hidden_online setting on the CatalogModifier object is obeyed. + * See CatalogModifierToggleOverrideType for possible values

+ */ + _FinalStage hiddenOnlineOverride(Optional hiddenOnlineOverride); - _FinalStage hiddenOnlineOverride(Object hiddenOnlineOverride); + _FinalStage hiddenOnlineOverride(CatalogModifierToggleOverrideType hiddenOnlineOverride); - _FinalStage onByDefaultOverride(Optional onByDefaultOverride); + /** + *

If YES, this setting overrides the on_by_default setting on the CatalogModifier object, + * and the modifier is always selected by default for the catalog item.

+ *

If NO, the modifier is not selected by default for this catalog item. + * NOT_SET means the on_by_default setting on the CatalogModifier object is obeyed. + * See CatalogModifierToggleOverrideType for possible values

+ */ + _FinalStage onByDefaultOverride(Optional onByDefaultOverride); - _FinalStage onByDefaultOverride(Object onByDefaultOverride); + _FinalStage onByDefaultOverride(CatalogModifierToggleOverrideType onByDefaultOverride); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements ModifierIdStage, _FinalStage { private String modifierId; - private Optional onByDefaultOverride = Optional.empty(); + private Optional onByDefaultOverride = Optional.empty(); - private Optional hiddenOnlineOverride = Optional.empty(); + private Optional hiddenOnlineOverride = Optional.empty(); private Optional onByDefault = Optional.empty(); @@ -180,28 +208,58 @@ public _FinalStage modifierId(@NotNull String modifierId) { return this; } + /** + *

If YES, this setting overrides the on_by_default setting on the CatalogModifier object, + * and the modifier is always selected by default for the catalog item.

+ *

If NO, the modifier is not selected by default for this catalog item. + * NOT_SET means the on_by_default setting on the CatalogModifier object is obeyed. + * See CatalogModifierToggleOverrideType for possible values

+ * @return Reference to {@code this} so that method calls can be chained together. + */ @java.lang.Override - public _FinalStage onByDefaultOverride(Object onByDefaultOverride) { + public _FinalStage onByDefaultOverride(CatalogModifierToggleOverrideType onByDefaultOverride) { this.onByDefaultOverride = Optional.ofNullable(onByDefaultOverride); return this; } + /** + *

If YES, this setting overrides the on_by_default setting on the CatalogModifier object, + * and the modifier is always selected by default for the catalog item.

+ *

If NO, the modifier is not selected by default for this catalog item. + * NOT_SET means the on_by_default setting on the CatalogModifier object is obeyed. + * See CatalogModifierToggleOverrideType for possible values

+ */ @java.lang.Override @JsonSetter(value = "on_by_default_override", nulls = Nulls.SKIP) - public _FinalStage onByDefaultOverride(Optional onByDefaultOverride) { + public _FinalStage onByDefaultOverride(Optional onByDefaultOverride) { this.onByDefaultOverride = onByDefaultOverride; return this; } + /** + *

If YES, this setting overrides the hidden_online setting on the CatalogModifier object, + * and the modifier is always hidden from online sales channels. + * If NO, the modifier is not hidden. It is always visible in online sales channels for this catalog item. + * NOT_SET means the hidden_online setting on the CatalogModifier object is obeyed. + * See CatalogModifierToggleOverrideType for possible values

+ * @return Reference to {@code this} so that method calls can be chained together. + */ @java.lang.Override - public _FinalStage hiddenOnlineOverride(Object hiddenOnlineOverride) { + public _FinalStage hiddenOnlineOverride(CatalogModifierToggleOverrideType hiddenOnlineOverride) { this.hiddenOnlineOverride = Optional.ofNullable(hiddenOnlineOverride); return this; } + /** + *

If YES, this setting overrides the hidden_online setting on the CatalogModifier object, + * and the modifier is always hidden from online sales channels. + * If NO, the modifier is not hidden. It is always visible in online sales channels for this catalog item. + * NOT_SET means the hidden_online setting on the CatalogModifier object is obeyed. + * See CatalogModifierToggleOverrideType for possible values

+ */ @java.lang.Override @JsonSetter(value = "hidden_online_override", nulls = Nulls.SKIP) - public _FinalStage hiddenOnlineOverride(Optional hiddenOnlineOverride) { + public _FinalStage hiddenOnlineOverride(Optional hiddenOnlineOverride) { this.hiddenOnlineOverride = hiddenOnlineOverride; return this; } diff --git a/src/main/java/com/squareup/square/types/CatalogModifierToggleOverrideType.java b/src/main/java/com/squareup/square/types/CatalogModifierToggleOverrideType.java new file mode 100644 index 00000000..8b552a1a --- /dev/null +++ b/src/main/java/com/squareup/square/types/CatalogModifierToggleOverrideType.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.squareup.square.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CatalogModifierToggleOverrideType { + public static final CatalogModifierToggleOverrideType YES = new CatalogModifierToggleOverrideType(Value.YES, "YES"); + + public static final CatalogModifierToggleOverrideType NOT_SET = + new CatalogModifierToggleOverrideType(Value.NOT_SET, "NOT_SET"); + + public static final CatalogModifierToggleOverrideType NO = new CatalogModifierToggleOverrideType(Value.NO, "NO"); + + private final Value value; + + private final String string; + + CatalogModifierToggleOverrideType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof CatalogModifierToggleOverrideType + && this.string.equals(((CatalogModifierToggleOverrideType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case YES: + return visitor.visitYes(); + case NOT_SET: + return visitor.visitNotSet(); + case NO: + return visitor.visitNo(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CatalogModifierToggleOverrideType valueOf(String value) { + switch (value) { + case "YES": + return YES; + case "NOT_SET": + return NOT_SET; + case "NO": + return NO; + default: + return new CatalogModifierToggleOverrideType(Value.UNKNOWN, value); + } + } + + public enum Value { + NO, + + YES, + + NOT_SET, + + UNKNOWN + } + + public interface Visitor { + T visitNo(); + + T visitYes(); + + T visitNotSet(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/squareup/square/types/CatalogProductSet.java b/src/main/java/com/squareup/square/types/CatalogProductSet.java index b2f07008..93e381ce 100644 --- a/src/main/java/com/squareup/square/types/CatalogProductSet.java +++ b/src/main/java/com/squareup/square/types/CatalogProductSet.java @@ -78,7 +78,7 @@ public Optional getName() { * match groups of products for a bulk discount, such as a discount for an * entree and side combo.

*

Only one of product_ids_all, product_ids_any, or all_products can be set.

- *

Max: 500 catalog object IDs.

+ *

Max: 5000 catalog object IDs.

*/ @JsonIgnore public Optional> getProductIdsAny() { @@ -92,7 +92,7 @@ public Optional> getProductIdsAny() { * @return Unique IDs for any CatalogObject included in this product set. * All objects in this set must be included in an order for a pricing rule to apply. *

Only one of product_ids_all, product_ids_any, or all_products can be set.

- *

Max: 500 catalog object IDs.

+ *

Max: 5000 catalog object IDs.

*/ @JsonIgnore public Optional> getProductIdsAll() { @@ -301,7 +301,7 @@ public Builder name(Nullable name) { * match groups of products for a bulk discount, such as a discount for an * entree and side combo.

*

Only one of product_ids_all, product_ids_any, or all_products can be set.

- *

Max: 500 catalog object IDs.

+ *

Max: 5000 catalog object IDs.

*/ @JsonSetter(value = "product_ids_any", nulls = Nulls.SKIP) public Builder productIdsAny(Optional> productIdsAny) { @@ -329,7 +329,7 @@ public Builder productIdsAny(Nullable> productIdsAny) { *

Unique IDs for any CatalogObject included in this product set. * All objects in this set must be included in an order for a pricing rule to apply.

*

Only one of product_ids_all, product_ids_any, or all_products can be set.

- *

Max: 500 catalog object IDs.

+ *

Max: 5000 catalog object IDs.

*/ @JsonSetter(value = "product_ids_all", nulls = Nulls.SKIP) public Builder productIdsAll(Optional> productIdsAll) { diff --git a/src/main/java/com/squareup/square/types/CreateBankAccountRequest.java b/src/main/java/com/squareup/square/types/CreateBankAccountRequest.java new file mode 100644 index 00000000..b42471c4 --- /dev/null +++ b/src/main/java/com/squareup/square/types/CreateBankAccountRequest.java @@ -0,0 +1,203 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.squareup.square.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.squareup.square.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateBankAccountRequest.Builder.class) +public final class CreateBankAccountRequest { + private final String idempotencyKey; + + private final String sourceId; + + private final Optional customerId; + + private final Map additionalProperties; + + private CreateBankAccountRequest( + String idempotencyKey, + String sourceId, + Optional customerId, + Map additionalProperties) { + this.idempotencyKey = idempotencyKey; + this.sourceId = sourceId; + this.customerId = customerId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Unique ID. For more information, see the + * Idempotency. + */ + @JsonProperty("idempotency_key") + public String getIdempotencyKey() { + return idempotencyKey; + } + + /** + * @return The ID of the source that represents the bank account information to be stored. This field + * accepts the payment token created by WebSDK + */ + @JsonProperty("source_id") + public String getSourceId() { + return sourceId; + } + + /** + * @return The ID of the customer associated with the bank account to be stored. + */ + @JsonProperty("customer_id") + public Optional getCustomerId() { + return customerId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateBankAccountRequest && equalTo((CreateBankAccountRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateBankAccountRequest other) { + return idempotencyKey.equals(other.idempotencyKey) + && sourceId.equals(other.sourceId) + && customerId.equals(other.customerId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.idempotencyKey, this.sourceId, this.customerId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdempotencyKeyStage builder() { + return new Builder(); + } + + public interface IdempotencyKeyStage { + /** + *

Unique ID. For more information, see the + * Idempotency.

+ */ + SourceIdStage idempotencyKey(@NotNull String idempotencyKey); + + Builder from(CreateBankAccountRequest other); + } + + public interface SourceIdStage { + /** + *

The ID of the source that represents the bank account information to be stored. This field + * accepts the payment token created by WebSDK

+ */ + _FinalStage sourceId(@NotNull String sourceId); + } + + public interface _FinalStage { + CreateBankAccountRequest build(); + + /** + *

The ID of the customer associated with the bank account to be stored.

+ */ + _FinalStage customerId(Optional customerId); + + _FinalStage customerId(String customerId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdempotencyKeyStage, SourceIdStage, _FinalStage { + private String idempotencyKey; + + private String sourceId; + + private Optional customerId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateBankAccountRequest other) { + idempotencyKey(other.getIdempotencyKey()); + sourceId(other.getSourceId()); + customerId(other.getCustomerId()); + return this; + } + + /** + *

Unique ID. For more information, see the + * Idempotency.

+ *

Unique ID. For more information, see the + * Idempotency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("idempotency_key") + public SourceIdStage idempotencyKey(@NotNull String idempotencyKey) { + this.idempotencyKey = Objects.requireNonNull(idempotencyKey, "idempotencyKey must not be null"); + return this; + } + + /** + *

The ID of the source that represents the bank account information to be stored. This field + * accepts the payment token created by WebSDK

+ *

The ID of the source that represents the bank account information to be stored. This field + * accepts the payment token created by WebSDK

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("source_id") + public _FinalStage sourceId(@NotNull String sourceId) { + this.sourceId = Objects.requireNonNull(sourceId, "sourceId must not be null"); + return this; + } + + /** + *

The ID of the customer associated with the bank account to be stored.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customerId(String customerId) { + this.customerId = Optional.ofNullable(customerId); + return this; + } + + /** + *

The ID of the customer associated with the bank account to be stored.

+ */ + @java.lang.Override + @JsonSetter(value = "customer_id", nulls = Nulls.SKIP) + public _FinalStage customerId(Optional customerId) { + this.customerId = customerId; + return this; + } + + @java.lang.Override + public CreateBankAccountRequest build() { + return new CreateBankAccountRequest(idempotencyKey, sourceId, customerId, additionalProperties); + } + } +} diff --git a/src/main/java/com/squareup/square/types/CreateBankAccountResponse.java b/src/main/java/com/squareup/square/types/CreateBankAccountResponse.java new file mode 100644 index 00000000..28179e25 --- /dev/null +++ b/src/main/java/com/squareup/square/types/CreateBankAccountResponse.java @@ -0,0 +1,131 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.squareup.square.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.squareup.square.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateBankAccountResponse.Builder.class) +public final class CreateBankAccountResponse { + private final Optional bankAccount; + + private final Optional> errors; + + private final Map additionalProperties; + + private CreateBankAccountResponse( + Optional bankAccount, Optional> errors, Map additionalProperties) { + this.bankAccount = bankAccount; + this.errors = errors; + this.additionalProperties = additionalProperties; + } + + /** + * @return The 'BankAccount' that was created. + */ + @JsonProperty("bank_account") + public Optional getBankAccount() { + return bankAccount; + } + + /** + * @return Information on errors encountered during the request. + */ + @JsonProperty("errors") + public Optional> getErrors() { + return errors; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateBankAccountResponse && equalTo((CreateBankAccountResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateBankAccountResponse other) { + return bankAccount.equals(other.bankAccount) && errors.equals(other.errors); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.bankAccount, this.errors); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional bankAccount = Optional.empty(); + + private Optional> errors = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateBankAccountResponse other) { + bankAccount(other.getBankAccount()); + errors(other.getErrors()); + return this; + } + + /** + *

The 'BankAccount' that was created.

+ */ + @JsonSetter(value = "bank_account", nulls = Nulls.SKIP) + public Builder bankAccount(Optional bankAccount) { + this.bankAccount = bankAccount; + return this; + } + + public Builder bankAccount(BankAccount bankAccount) { + this.bankAccount = Optional.ofNullable(bankAccount); + return this; + } + + /** + *

Information on errors encountered during the request.

+ */ + @JsonSetter(value = "errors", nulls = Nulls.SKIP) + public Builder errors(Optional> errors) { + this.errors = errors; + return this; + } + + public Builder errors(List errors) { + this.errors = Optional.ofNullable(errors); + return this; + } + + public CreateBankAccountResponse build() { + return new CreateBankAccountResponse(bankAccount, errors, additionalProperties); + } + } +} diff --git a/src/main/java/com/squareup/square/types/CreateMobileAuthorizationCodeRequest.java b/src/main/java/com/squareup/square/types/CreateMobileAuthorizationCodeRequest.java deleted file mode 100644 index 4f249ce8..00000000 --- a/src/main/java/com/squareup/square/types/CreateMobileAuthorizationCodeRequest.java +++ /dev/null @@ -1,103 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squareup.square.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squareup.square.core.ObjectMappers; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = CreateMobileAuthorizationCodeRequest.Builder.class) -public final class CreateMobileAuthorizationCodeRequest { - private final Optional locationId; - - private final Map additionalProperties; - - private CreateMobileAuthorizationCodeRequest( - Optional locationId, Map additionalProperties) { - this.locationId = locationId; - this.additionalProperties = additionalProperties; - } - - /** - * @return The Square location ID that the authorization code should be tied to. - */ - @JsonProperty("location_id") - public Optional getLocationId() { - return locationId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateMobileAuthorizationCodeRequest - && equalTo((CreateMobileAuthorizationCodeRequest) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CreateMobileAuthorizationCodeRequest other) { - return locationId.equals(other.locationId); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.locationId); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional locationId = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(CreateMobileAuthorizationCodeRequest other) { - locationId(other.getLocationId()); - return this; - } - - /** - *

The Square location ID that the authorization code should be tied to.

- */ - @JsonSetter(value = "location_id", nulls = Nulls.SKIP) - public Builder locationId(Optional locationId) { - this.locationId = locationId; - return this; - } - - public Builder locationId(String locationId) { - this.locationId = Optional.ofNullable(locationId); - return this; - } - - public CreateMobileAuthorizationCodeRequest build() { - return new CreateMobileAuthorizationCodeRequest(locationId, additionalProperties); - } - } -} diff --git a/src/main/java/com/squareup/square/types/CreateMobileAuthorizationCodeResponse.java b/src/main/java/com/squareup/square/types/CreateMobileAuthorizationCodeResponse.java deleted file mode 100644 index dd56b13f..00000000 --- a/src/main/java/com/squareup/square/types/CreateMobileAuthorizationCodeResponse.java +++ /dev/null @@ -1,170 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squareup.square.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squareup.square.core.ObjectMappers; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = CreateMobileAuthorizationCodeResponse.Builder.class) -public final class CreateMobileAuthorizationCodeResponse { - private final Optional authorizationCode; - - private final Optional expiresAt; - - private final Optional> errors; - - private final Map additionalProperties; - - private CreateMobileAuthorizationCodeResponse( - Optional authorizationCode, - Optional expiresAt, - Optional> errors, - Map additionalProperties) { - this.authorizationCode = authorizationCode; - this.expiresAt = expiresAt; - this.errors = errors; - this.additionalProperties = additionalProperties; - } - - /** - * @return The generated authorization code that connects a mobile application instance - * to a Square account. - */ - @JsonProperty("authorization_code") - public Optional getAuthorizationCode() { - return authorizationCode; - } - - /** - * @return The timestamp when authorization_code expires, in - * RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). - */ - @JsonProperty("expires_at") - public Optional getExpiresAt() { - return expiresAt; - } - - /** - * @return Any errors that occurred during the request. - */ - @JsonProperty("errors") - public Optional> getErrors() { - return errors; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateMobileAuthorizationCodeResponse - && equalTo((CreateMobileAuthorizationCodeResponse) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CreateMobileAuthorizationCodeResponse other) { - return authorizationCode.equals(other.authorizationCode) - && expiresAt.equals(other.expiresAt) - && errors.equals(other.errors); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.authorizationCode, this.expiresAt, this.errors); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional authorizationCode = Optional.empty(); - - private Optional expiresAt = Optional.empty(); - - private Optional> errors = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(CreateMobileAuthorizationCodeResponse other) { - authorizationCode(other.getAuthorizationCode()); - expiresAt(other.getExpiresAt()); - errors(other.getErrors()); - return this; - } - - /** - *

The generated authorization code that connects a mobile application instance - * to a Square account.

- */ - @JsonSetter(value = "authorization_code", nulls = Nulls.SKIP) - public Builder authorizationCode(Optional authorizationCode) { - this.authorizationCode = authorizationCode; - return this; - } - - public Builder authorizationCode(String authorizationCode) { - this.authorizationCode = Optional.ofNullable(authorizationCode); - return this; - } - - /** - *

The timestamp when authorization_code expires, in - * RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").

- */ - @JsonSetter(value = "expires_at", nulls = Nulls.SKIP) - public Builder expiresAt(Optional expiresAt) { - this.expiresAt = expiresAt; - return this; - } - - public Builder expiresAt(String expiresAt) { - this.expiresAt = Optional.ofNullable(expiresAt); - return this; - } - - /** - *

Any errors that occurred during the request.

- */ - @JsonSetter(value = "errors", nulls = Nulls.SKIP) - public Builder errors(Optional> errors) { - this.errors = errors; - return this; - } - - public Builder errors(List errors) { - this.errors = Optional.ofNullable(errors); - return this; - } - - public CreateMobileAuthorizationCodeResponse build() { - return new CreateMobileAuthorizationCodeResponse( - authorizationCode, expiresAt, errors, additionalProperties); - } - } -} diff --git a/src/main/java/com/squareup/square/types/CreatePaymentRequest.java b/src/main/java/com/squareup/square/types/CreatePaymentRequest.java index 287849b0..5c6df699 100644 --- a/src/main/java/com/squareup/square/types/CreatePaymentRequest.java +++ b/src/main/java/com/squareup/square/types/CreatePaymentRequest.java @@ -172,6 +172,7 @@ public Optional getAmountMoney() { *

The amount must be specified in the smallest denomination of the applicable currency * (for example, US dollar amounts are specified in cents). For more information, see * Working with Monetary Amounts.

+ *

Tips for external vendors such as a 3rd party delivery courier must be recorded using Order.service_charges.

*

The currency code must match the currency associated with the business * that is accepting the payment.

*/ @@ -530,6 +531,7 @@ public interface _FinalStage { *

The amount must be specified in the smallest denomination of the applicable currency * (for example, US dollar amounts are specified in cents). For more information, see * Working with Monetary Amounts.

+ *

Tips for external vendors such as a 3rd party delivery courier must be recorded using Order.service_charges.

*

The currency code must match the currency associated with the business * that is accepting the payment.

*/ @@ -1415,6 +1417,7 @@ public _FinalStage appFeeMoney(Optional appFeeMoney) { *

The amount must be specified in the smallest denomination of the applicable currency * (for example, US dollar amounts are specified in cents). For more information, see * Working with Monetary Amounts.

+ *

Tips for external vendors such as a 3rd party delivery courier must be recorded using Order.service_charges.

*

The currency code must match the currency associated with the business * that is accepting the payment.

* @return Reference to {@code this} so that method calls can be chained together. @@ -1430,6 +1433,7 @@ public _FinalStage tipMoney(Money tipMoney) { *

The amount must be specified in the smallest denomination of the applicable currency * (for example, US dollar amounts are specified in cents). For more information, see * Working with Monetary Amounts.

+ *

Tips for external vendors such as a 3rd party delivery courier must be recorded using Order.service_charges.

*

The currency code must match the currency associated with the business * that is accepting the payment.

*/ diff --git a/src/main/java/com/squareup/square/types/DeviceCheckoutOptions.java b/src/main/java/com/squareup/square/types/DeviceCheckoutOptions.java index 0b8aa2d2..78a62c12 100644 --- a/src/main/java/com/squareup/square/types/DeviceCheckoutOptions.java +++ b/src/main/java/com/squareup/square/types/DeviceCheckoutOptions.java @@ -34,6 +34,8 @@ public final class DeviceCheckoutOptions { private final Optional showItemizedCart; + private final Optional allowAutoCardSurcharge; + private final Map additionalProperties; private DeviceCheckoutOptions( @@ -42,12 +44,14 @@ private DeviceCheckoutOptions( Optional collectSignature, Optional tipSettings, Optional showItemizedCart, + Optional allowAutoCardSurcharge, Map additionalProperties) { this.deviceId = deviceId; this.skipReceiptScreen = skipReceiptScreen; this.collectSignature = collectSignature; this.tipSettings = tipSettings; this.showItemizedCart = showItemizedCart; + this.allowAutoCardSurcharge = allowAutoCardSurcharge; this.additionalProperties = additionalProperties; } @@ -103,6 +107,20 @@ public Optional getShowItemizedCart() { return showItemizedCart; } + /** + * @return Controls whether the mobile client applies Auto Card Surcharge (ACS) during checkout. + * If true, ACS is applied based on Dashboard configuration. + * If false, ACS is not applied regardless of that configuration. + * For more information, see Add a Card Surcharge. + */ + @JsonIgnore + public Optional getAllowAutoCardSurcharge() { + if (allowAutoCardSurcharge == null) { + return Optional.empty(); + } + return allowAutoCardSurcharge; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("skip_receipt_screen") private Optional _getSkipReceiptScreen() { @@ -121,6 +139,12 @@ private Optional _getShowItemizedCart() { return showItemizedCart; } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("allow_auto_card_surcharge") + private Optional _getAllowAutoCardSurcharge() { + return allowAutoCardSurcharge; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -137,13 +161,19 @@ private boolean equalTo(DeviceCheckoutOptions other) { && skipReceiptScreen.equals(other.skipReceiptScreen) && collectSignature.equals(other.collectSignature) && tipSettings.equals(other.tipSettings) - && showItemizedCart.equals(other.showItemizedCart); + && showItemizedCart.equals(other.showItemizedCart) + && allowAutoCardSurcharge.equals(other.allowAutoCardSurcharge); } @java.lang.Override public int hashCode() { return Objects.hash( - this.deviceId, this.skipReceiptScreen, this.collectSignature, this.tipSettings, this.showItemizedCart); + this.deviceId, + this.skipReceiptScreen, + this.collectSignature, + this.tipSettings, + this.showItemizedCart, + this.allowAutoCardSurcharge); } @java.lang.Override @@ -203,12 +233,26 @@ public interface _FinalStage { _FinalStage showItemizedCart(Boolean showItemizedCart); _FinalStage showItemizedCart(Nullable showItemizedCart); + + /** + *

Controls whether the mobile client applies Auto Card Surcharge (ACS) during checkout. + * If true, ACS is applied based on Dashboard configuration. + * If false, ACS is not applied regardless of that configuration. + * For more information, see Add a Card Surcharge.

+ */ + _FinalStage allowAutoCardSurcharge(Optional allowAutoCardSurcharge); + + _FinalStage allowAutoCardSurcharge(Boolean allowAutoCardSurcharge); + + _FinalStage allowAutoCardSurcharge(Nullable allowAutoCardSurcharge); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements DeviceIdStage, _FinalStage { private String deviceId; + private Optional allowAutoCardSurcharge = Optional.empty(); + private Optional showItemizedCart = Optional.empty(); private Optional tipSettings = Optional.empty(); @@ -229,6 +273,7 @@ public Builder from(DeviceCheckoutOptions other) { collectSignature(other.getCollectSignature()); tipSettings(other.getTipSettings()); showItemizedCart(other.getShowItemizedCart()); + allowAutoCardSurcharge(other.getAllowAutoCardSurcharge()); return this; } @@ -248,6 +293,51 @@ public _FinalStage deviceId(@NotNull String deviceId) { return this; } + /** + *

Controls whether the mobile client applies Auto Card Surcharge (ACS) during checkout. + * If true, ACS is applied based on Dashboard configuration. + * If false, ACS is not applied regardless of that configuration. + * For more information, see Add a Card Surcharge.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage allowAutoCardSurcharge(Nullable allowAutoCardSurcharge) { + if (allowAutoCardSurcharge.isNull()) { + this.allowAutoCardSurcharge = null; + } else if (allowAutoCardSurcharge.isEmpty()) { + this.allowAutoCardSurcharge = Optional.empty(); + } else { + this.allowAutoCardSurcharge = Optional.of(allowAutoCardSurcharge.get()); + } + return this; + } + + /** + *

Controls whether the mobile client applies Auto Card Surcharge (ACS) during checkout. + * If true, ACS is applied based on Dashboard configuration. + * If false, ACS is not applied regardless of that configuration. + * For more information, see Add a Card Surcharge.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage allowAutoCardSurcharge(Boolean allowAutoCardSurcharge) { + this.allowAutoCardSurcharge = Optional.ofNullable(allowAutoCardSurcharge); + return this; + } + + /** + *

Controls whether the mobile client applies Auto Card Surcharge (ACS) during checkout. + * If true, ACS is applied based on Dashboard configuration. + * If false, ACS is not applied regardless of that configuration. + * For more information, see Add a Card Surcharge.

+ */ + @java.lang.Override + @JsonSetter(value = "allow_auto_card_surcharge", nulls = Nulls.SKIP) + public _FinalStage allowAutoCardSurcharge(Optional allowAutoCardSurcharge) { + this.allowAutoCardSurcharge = allowAutoCardSurcharge; + return this; + } + /** *

Show the itemization screen prior to taking a payment. This field is only meaningful when the * checkout includes an order ID. Defaults to true.

@@ -382,7 +472,13 @@ public _FinalStage skipReceiptScreen(Optional skipReceiptScreen) { @java.lang.Override public DeviceCheckoutOptions build() { return new DeviceCheckoutOptions( - deviceId, skipReceiptScreen, collectSignature, tipSettings, showItemizedCart, additionalProperties); + deviceId, + skipReceiptScreen, + collectSignature, + tipSettings, + showItemizedCart, + allowAutoCardSurcharge, + additionalProperties); } } } diff --git a/src/main/java/com/squareup/square/types/DigitalWalletDetails.java b/src/main/java/com/squareup/square/types/DigitalWalletDetails.java index b313aaae..0c8021ed 100644 --- a/src/main/java/com/squareup/square/types/DigitalWalletDetails.java +++ b/src/main/java/com/squareup/square/types/DigitalWalletDetails.java @@ -16,6 +16,7 @@ import com.squareup.square.core.NullableNonemptyFilter; import com.squareup.square.core.ObjectMappers; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -29,16 +30,20 @@ public final class DigitalWalletDetails { private final Optional cashAppDetails; + private final Optional> errors; + private final Map additionalProperties; private DigitalWalletDetails( Optional status, Optional brand, Optional cashAppDetails, + Optional> errors, Map additionalProperties) { this.status = status; this.brand = brand; this.cashAppDetails = cashAppDetails; + this.errors = errors; this.additionalProperties = additionalProperties; } @@ -56,7 +61,7 @@ public Optional getStatus() { /** * @return The brand used for the WALLET payment. The brand can be CASH_APP, PAYPAY, ALIPAY, - * RAKUTEN_PAY, AU_PAY, D_BARAI, MERPAY, WECHAT_PAY or UNKNOWN. + * RAKUTEN_PAY, AU_PAY, D_BARAI, MERPAY, WECHAT_PAY, LIGHTNING or UNKNOWN. */ @JsonIgnore public Optional getBrand() { @@ -74,6 +79,14 @@ public Optional getCashAppDetails() { return cashAppDetails; } + /** + * @return Information about errors encountered during the payment. + */ + @JsonProperty("errors") + public Optional> getErrors() { + return errors; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("status") private Optional _getStatus() { @@ -98,12 +111,15 @@ public Map getAdditionalProperties() { } private boolean equalTo(DigitalWalletDetails other) { - return status.equals(other.status) && brand.equals(other.brand) && cashAppDetails.equals(other.cashAppDetails); + return status.equals(other.status) + && brand.equals(other.brand) + && cashAppDetails.equals(other.cashAppDetails) + && errors.equals(other.errors); } @java.lang.Override public int hashCode() { - return Objects.hash(this.status, this.brand, this.cashAppDetails); + return Objects.hash(this.status, this.brand, this.cashAppDetails, this.errors); } @java.lang.Override @@ -123,6 +139,8 @@ public static final class Builder { private Optional cashAppDetails = Optional.empty(); + private Optional> errors = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -132,6 +150,7 @@ public Builder from(DigitalWalletDetails other) { status(other.getStatus()); brand(other.getBrand()); cashAppDetails(other.getCashAppDetails()); + errors(other.getErrors()); return this; } @@ -163,7 +182,7 @@ public Builder status(Nullable status) { /** *

The brand used for the WALLET payment. The brand can be CASH_APP, PAYPAY, ALIPAY, - * RAKUTEN_PAY, AU_PAY, D_BARAI, MERPAY, WECHAT_PAY or UNKNOWN.

+ * RAKUTEN_PAY, AU_PAY, D_BARAI, MERPAY, WECHAT_PAY, LIGHTNING or UNKNOWN.

*/ @JsonSetter(value = "brand", nulls = Nulls.SKIP) public Builder brand(Optional brand) { @@ -201,8 +220,22 @@ public Builder cashAppDetails(CashAppDetails cashAppDetails) { return this; } + /** + *

Information about errors encountered during the payment.

+ */ + @JsonSetter(value = "errors", nulls = Nulls.SKIP) + public Builder errors(Optional> errors) { + this.errors = errors; + return this; + } + + public Builder errors(List errors) { + this.errors = Optional.ofNullable(errors); + return this; + } + public DigitalWalletDetails build() { - return new DigitalWalletDetails(status, brand, cashAppDetails, additionalProperties); + return new DigitalWalletDetails(status, brand, cashAppDetails, errors, additionalProperties); } } } diff --git a/src/main/java/com/squareup/square/types/DisableBankAccountRequest.java b/src/main/java/com/squareup/square/types/DisableBankAccountRequest.java new file mode 100644 index 00000000..e03792f7 --- /dev/null +++ b/src/main/java/com/squareup/square/types/DisableBankAccountRequest.java @@ -0,0 +1,113 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.squareup.square.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.squareup.square.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DisableBankAccountRequest.Builder.class) +public final class DisableBankAccountRequest { + private final String bankAccountId; + + private final Map additionalProperties; + + private DisableBankAccountRequest(String bankAccountId, Map additionalProperties) { + this.bankAccountId = bankAccountId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The ID of the bank account to disable. + */ + @JsonProperty("bank_account_id") + public String getBankAccountId() { + return bankAccountId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DisableBankAccountRequest && equalTo((DisableBankAccountRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DisableBankAccountRequest other) { + return bankAccountId.equals(other.bankAccountId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.bankAccountId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BankAccountIdStage builder() { + return new Builder(); + } + + public interface BankAccountIdStage { + /** + *

The ID of the bank account to disable.

+ */ + _FinalStage bankAccountId(@NotNull String bankAccountId); + + Builder from(DisableBankAccountRequest other); + } + + public interface _FinalStage { + DisableBankAccountRequest build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BankAccountIdStage, _FinalStage { + private String bankAccountId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DisableBankAccountRequest other) { + bankAccountId(other.getBankAccountId()); + return this; + } + + /** + *

The ID of the bank account to disable.

+ *

The ID of the bank account to disable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("bank_account_id") + public _FinalStage bankAccountId(@NotNull String bankAccountId) { + this.bankAccountId = Objects.requireNonNull(bankAccountId, "bankAccountId must not be null"); + return this; + } + + @java.lang.Override + public DisableBankAccountRequest build() { + return new DisableBankAccountRequest(bankAccountId, additionalProperties); + } + } +} diff --git a/src/main/java/com/squareup/square/types/DisableBankAccountResponse.java b/src/main/java/com/squareup/square/types/DisableBankAccountResponse.java new file mode 100644 index 00000000..6cb42a19 --- /dev/null +++ b/src/main/java/com/squareup/square/types/DisableBankAccountResponse.java @@ -0,0 +1,131 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.squareup.square.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.squareup.square.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DisableBankAccountResponse.Builder.class) +public final class DisableBankAccountResponse { + private final Optional bankAccount; + + private final Optional> errors; + + private final Map additionalProperties; + + private DisableBankAccountResponse( + Optional bankAccount, Optional> errors, Map additionalProperties) { + this.bankAccount = bankAccount; + this.errors = errors; + this.additionalProperties = additionalProperties; + } + + /** + * @return The disabled 'BankAccount' + */ + @JsonProperty("bank_account") + public Optional getBankAccount() { + return bankAccount; + } + + /** + * @return Information on errors encountered during the request. + */ + @JsonProperty("errors") + public Optional> getErrors() { + return errors; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DisableBankAccountResponse && equalTo((DisableBankAccountResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DisableBankAccountResponse other) { + return bankAccount.equals(other.bankAccount) && errors.equals(other.errors); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.bankAccount, this.errors); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional bankAccount = Optional.empty(); + + private Optional> errors = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DisableBankAccountResponse other) { + bankAccount(other.getBankAccount()); + errors(other.getErrors()); + return this; + } + + /** + *

The disabled 'BankAccount'

+ */ + @JsonSetter(value = "bank_account", nulls = Nulls.SKIP) + public Builder bankAccount(Optional bankAccount) { + this.bankAccount = bankAccount; + return this; + } + + public Builder bankAccount(BankAccount bankAccount) { + this.bankAccount = Optional.ofNullable(bankAccount); + return this; + } + + /** + *

Information on errors encountered during the request.

+ */ + @JsonSetter(value = "errors", nulls = Nulls.SKIP) + public Builder errors(Optional> errors) { + this.errors = errors; + return this; + } + + public Builder errors(List errors) { + this.errors = Optional.ofNullable(errors); + return this; + } + + public DisableBankAccountResponse build() { + return new DisableBankAccountResponse(bankAccount, errors, additionalProperties); + } + } +} diff --git a/src/main/java/com/squareup/square/types/ErrorCode.java b/src/main/java/com/squareup/square/types/ErrorCode.java index 926032ce..cc257697 100644 --- a/src/main/java/com/squareup/square/types/ErrorCode.java +++ b/src/main/java/com/squareup/square/types/ErrorCode.java @@ -207,6 +207,9 @@ public final class ErrorCode { public static final ErrorCode PLAID_ERROR_ITEM_LOGIN_REQUIRED = new ErrorCode(Value.PLAID_ERROR_ITEM_LOGIN_REQUIRED, "PLAID_ERROR_ITEM_LOGIN_REQUIRED"); + public static final ErrorCode PAYMENT_SOURCE_NOT_ENABLED_FOR_TARGET = + new ErrorCode(Value.PAYMENT_SOURCE_NOT_ENABLED_FOR_TARGET, "PAYMENT_SOURCE_NOT_ENABLED_FOR_TARGET"); + public static final ErrorCode EXPECTED_BOOLEAN = new ErrorCode(Value.EXPECTED_BOOLEAN, "EXPECTED_BOOLEAN"); public static final ErrorCode ARRAY_LENGTH_TOO_SHORT = @@ -262,6 +265,9 @@ public final class ErrorCode { public static final ErrorCode REFUND_DECLINED = new ErrorCode(Value.REFUND_DECLINED, "REFUND_DECLINED"); + public static final ErrorCode PARTIAL_PAYMENT_DELAY_CAPTURE_NOT_SUPPORTED = new ErrorCode( + Value.PARTIAL_PAYMENT_DELAY_CAPTURE_NOT_SUPPORTED, "PARTIAL_PAYMENT_DELAY_CAPTURE_NOT_SUPPORTED"); + public static final ErrorCode INVALID_EXPIRATION_DATE = new ErrorCode(Value.INVALID_EXPIRATION_DATE, "INVALID_EXPIRATION_DATE"); @@ -576,6 +582,8 @@ public T visit(Visitor visitor) { return visitor.visitInsufficientFunds(); case PLAID_ERROR_ITEM_LOGIN_REQUIRED: return visitor.visitPlaidErrorItemLoginRequired(); + case PAYMENT_SOURCE_NOT_ENABLED_FOR_TARGET: + return visitor.visitPaymentSourceNotEnabledForTarget(); case EXPECTED_BOOLEAN: return visitor.visitExpectedBoolean(); case ARRAY_LENGTH_TOO_SHORT: @@ -622,6 +630,8 @@ public T visit(Visitor visitor) { return visitor.visitGone(); case REFUND_DECLINED: return visitor.visitRefundDeclined(); + case PARTIAL_PAYMENT_DELAY_CAPTURE_NOT_SUPPORTED: + return visitor.visitPartialPaymentDelayCaptureNotSupported(); case INVALID_EXPIRATION_DATE: return visitor.visitInvalidExpirationDate(); case EXPECTED_OBJECT: @@ -891,6 +901,8 @@ public static ErrorCode valueOf(String value) { return INSUFFICIENT_FUNDS; case "PLAID_ERROR_ITEM_LOGIN_REQUIRED": return PLAID_ERROR_ITEM_LOGIN_REQUIRED; + case "PAYMENT_SOURCE_NOT_ENABLED_FOR_TARGET": + return PAYMENT_SOURCE_NOT_ENABLED_FOR_TARGET; case "EXPECTED_BOOLEAN": return EXPECTED_BOOLEAN; case "ARRAY_LENGTH_TOO_SHORT": @@ -937,6 +949,8 @@ public static ErrorCode valueOf(String value) { return GONE; case "REFUND_DECLINED": return REFUND_DECLINED; + case "PARTIAL_PAYMENT_DELAY_CAPTURE_NOT_SUPPORTED": + return PARTIAL_PAYMENT_DELAY_CAPTURE_NOT_SUPPORTED; case "INVALID_EXPIRATION_DATE": return INVALID_EXPIRATION_DATE; case "EXPECTED_OBJECT": @@ -1265,6 +1279,8 @@ public enum Value { ORDER_UNPAID_NOT_RETURNABLE, + PARTIAL_PAYMENT_DELAY_CAPTURE_NOT_SUPPORTED, + IDEMPOTENCY_KEY_REUSED, UNEXPECTED_VALUE, @@ -1295,6 +1311,8 @@ public enum Value { PLAID_ERROR_RATE_LIMIT, + PAYMENT_SOURCE_NOT_ENABLED_FOR_TARGET, + CARD_DECLINED, VERIFY_CVV_FAILURE, @@ -1575,6 +1593,8 @@ public interface Visitor { T visitOrderUnpaidNotReturnable(); + T visitPartialPaymentDelayCaptureNotSupported(); + T visitIdempotencyKeyReused(); T visitUnexpectedValue(); @@ -1605,6 +1625,8 @@ public interface Visitor { T visitPlaidErrorRateLimit(); + T visitPaymentSourceNotEnabledForTarget(); + T visitCardDeclined(); T visitVerifyCvvFailure(); diff --git a/src/main/java/com/squareup/square/types/FulfillmentDeliveryDetails.java b/src/main/java/com/squareup/square/types/FulfillmentDeliveryDetails.java index 052344a9..78b17bb6 100644 --- a/src/main/java/com/squareup/square/types/FulfillmentDeliveryDetails.java +++ b/src/main/java/com/squareup/square/types/FulfillmentDeliveryDetails.java @@ -132,7 +132,7 @@ public Optional getRecipient() { /** * @return Indicates the fulfillment delivery schedule type. If SCHEDULED, then - * deliver_at is required. If ASAP, then prep_time_duration is required. The default is SCHEDULED. + * deliver_at is required. The default is SCHEDULED. * See OrderFulfillmentDeliveryDetailsScheduleType for possible values */ @JsonProperty("schedule_type") @@ -154,13 +154,13 @@ public Optional getPlacedAt() { /** * @return The timestamp * that represents the start of the delivery period. - * When the fulfillment schedule_type is ASAP, the field is automatically - * set to the current time plus the prep_time_duration. - * Otherwise, the application can set this field while the fulfillment state is + * The application can set this field while the fulfillment state is * PROPOSED, RESERVED, or PREPARED (any time before the * terminal state such as COMPLETED, CANCELED, and FAILED). *

The timestamp must be in RFC 3339 format * (for example, "2016-09-04T23:59:33.123Z").

+ *

For fulfillments with the schedule type ASAP, this is automatically set + * to the current time plus prep_time_duration, if available.

*/ @JsonIgnore public Optional getDeliverAt() { @@ -171,8 +171,10 @@ public Optional getDeliverAt() { } /** - * @return The duration of time it takes to prepare and deliver this fulfillment. - * The duration must be in RFC 3339 format (for example, "P1W3D"). + * @return The duration + * needed to prepare and deliver this fulfillment. + * The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse + * "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes. */ @JsonIgnore public Optional getPrepTimeDuration() { @@ -183,11 +185,13 @@ public Optional getPrepTimeDuration() { } /** - * @return The time period after deliver_at in which to deliver the order. + * @return The duration + * after deliver_at in which to deliver the order. * Applications can set this field when the fulfillment state is * PROPOSED, RESERVED, or PREPARED (any time before the terminal state * such as COMPLETED, CANCELED, and FAILED). - *

The duration must be in RFC 3339 format (for example, "P1W3D").

+ *

The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse + * "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes.

*/ @JsonIgnore public Optional getDeliveryWindowDuration() { @@ -303,8 +307,10 @@ public Optional getCourierPickupAt() { } /** - * @return The time period after courier_pickup_at in which the courier should pick up the order. - * The duration must be in RFC 3339 format (for example, "P1W3D"). + * @return The duration + * after courier_pickup_at in which the courier should pick up the order. + * The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse + * "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes. */ @JsonIgnore public Optional getCourierPickupWindowDuration() { @@ -653,7 +659,7 @@ public Builder recipient(FulfillmentRecipient recipient) { /** *

Indicates the fulfillment delivery schedule type. If SCHEDULED, then - * deliver_at is required. If ASAP, then prep_time_duration is required. The default is SCHEDULED. + * deliver_at is required. The default is SCHEDULED. * See OrderFulfillmentDeliveryDetailsScheduleType for possible values

*/ @JsonSetter(value = "schedule_type", nulls = Nulls.SKIP) @@ -689,13 +695,13 @@ public Builder placedAt(String placedAt) { /** *

The timestamp * that represents the start of the delivery period. - * When the fulfillment schedule_type is ASAP, the field is automatically - * set to the current time plus the prep_time_duration. - * Otherwise, the application can set this field while the fulfillment state is + * The application can set this field while the fulfillment state is * PROPOSED, RESERVED, or PREPARED (any time before the * terminal state such as COMPLETED, CANCELED, and FAILED).

*

The timestamp must be in RFC 3339 format * (for example, "2016-09-04T23:59:33.123Z").

+ *

For fulfillments with the schedule type ASAP, this is automatically set + * to the current time plus prep_time_duration, if available.

*/ @JsonSetter(value = "deliver_at", nulls = Nulls.SKIP) public Builder deliverAt(Optional deliverAt) { @@ -720,8 +726,10 @@ public Builder deliverAt(Nullable deliverAt) { } /** - *

The duration of time it takes to prepare and deliver this fulfillment. - * The duration must be in RFC 3339 format (for example, "P1W3D").

+ *

The duration + * needed to prepare and deliver this fulfillment. + * The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse + * "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes.

*/ @JsonSetter(value = "prep_time_duration", nulls = Nulls.SKIP) public Builder prepTimeDuration(Optional prepTimeDuration) { @@ -746,11 +754,13 @@ public Builder prepTimeDuration(Nullable prepTimeDuration) { } /** - *

The time period after deliver_at in which to deliver the order. + *

The duration + * after deliver_at in which to deliver the order. * Applications can set this field when the fulfillment state is * PROPOSED, RESERVED, or PREPARED (any time before the terminal state * such as COMPLETED, CANCELED, and FAILED).

- *

The duration must be in RFC 3339 format (for example, "P1W3D").

+ *

The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse + * "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes.

*/ @JsonSetter(value = "delivery_window_duration", nulls = Nulls.SKIP) public Builder deliveryWindowDuration(Optional deliveryWindowDuration) { @@ -966,8 +976,10 @@ public Builder courierPickupAt(Nullable courierPickupAt) { } /** - *

The time period after courier_pickup_at in which the courier should pick up the order. - * The duration must be in RFC 3339 format (for example, "P1W3D").

+ *

The duration + * after courier_pickup_at in which the courier should pick up the order. + * The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse + * "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes.

*/ @JsonSetter(value = "courier_pickup_window_duration", nulls = Nulls.SKIP) public Builder courierPickupWindowDuration(Optional courierPickupWindowDuration) { diff --git a/src/main/java/com/squareup/square/types/FulfillmentPickupDetails.java b/src/main/java/com/squareup/square/types/FulfillmentPickupDetails.java index 3280a42e..b0e7cb85 100644 --- a/src/main/java/com/squareup/square/types/FulfillmentPickupDetails.java +++ b/src/main/java/com/squareup/square/types/FulfillmentPickupDetails.java @@ -127,8 +127,9 @@ public Optional getExpiresAt() { } /** - * @return The duration of time after which an in progress pickup fulfillment is automatically moved - * to the COMPLETED state. The duration must be in RFC 3339 format (for example, "P1W3D"). + * @return The duration + * after which an in-progress pickup fulfillment is automatically moved + * to the COMPLETED state. The duration must be in RFC 3339 format (for example, "PT4H" for 4 hours). *

If not set, this pickup fulfillment remains in progress until it is canceled or completed.

*/ @JsonIgnore @@ -153,7 +154,7 @@ public Optional getScheduleType() { * that represents the start of the pickup window. Must be in RFC 3339 timestamp format, e.g., * "2016-09-04T23:59:33.123Z". *

For fulfillments with the schedule type ASAP, this is automatically set - * to the current time plus the expected duration to prepare the fulfillment.

+ * to the current time plus prep_time_duration, if available.

*/ @JsonIgnore public Optional getPickupAt() { @@ -164,9 +165,11 @@ public Optional getPickupAt() { } /** - * @return The window of time in which the order should be picked up after the pickup_at timestamp. - * Must be in RFC 3339 duration format, e.g., "P1W3D". Can be used as an - * informational guideline for merchants. + * @return The duration + * in which the order should be picked up after the pickup_at timestamp. + * The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse + * "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes. + *

Can be used as an informational guideline for merchants.

*/ @JsonIgnore public Optional getPickupWindowDuration() { @@ -177,8 +180,10 @@ public Optional getPickupWindowDuration() { } /** - * @return The duration of time it takes to prepare this fulfillment. - * The duration must be in RFC 3339 format (for example, "P1W3D"). + * @return The duration + * needed to prepare this fulfillment. + * The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse + * "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes. */ @JsonIgnore public Optional getPrepTimeDuration() { @@ -522,8 +527,9 @@ public Builder expiresAt(Nullable expiresAt) { } /** - *

The duration of time after which an in progress pickup fulfillment is automatically moved - * to the COMPLETED state. The duration must be in RFC 3339 format (for example, "P1W3D").

+ *

The duration + * after which an in-progress pickup fulfillment is automatically moved + * to the COMPLETED state. The duration must be in RFC 3339 format (for example, "PT4H" for 4 hours).

*

If not set, this pickup fulfillment remains in progress until it is canceled or completed.

*/ @JsonSetter(value = "auto_complete_duration", nulls = Nulls.SKIP) @@ -568,7 +574,7 @@ public Builder scheduleType(FulfillmentPickupDetailsScheduleType scheduleType) { * that represents the start of the pickup window. Must be in RFC 3339 timestamp format, e.g., * "2016-09-04T23:59:33.123Z".

*

For fulfillments with the schedule type ASAP, this is automatically set - * to the current time plus the expected duration to prepare the fulfillment.

+ * to the current time plus prep_time_duration, if available.

*/ @JsonSetter(value = "pickup_at", nulls = Nulls.SKIP) public Builder pickupAt(Optional pickupAt) { @@ -593,9 +599,11 @@ public Builder pickupAt(Nullable pickupAt) { } /** - *

The window of time in which the order should be picked up after the pickup_at timestamp. - * Must be in RFC 3339 duration format, e.g., "P1W3D". Can be used as an - * informational guideline for merchants.

+ *

The duration + * in which the order should be picked up after the pickup_at timestamp. + * The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse + * "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes.

+ *

Can be used as an informational guideline for merchants.

*/ @JsonSetter(value = "pickup_window_duration", nulls = Nulls.SKIP) public Builder pickupWindowDuration(Optional pickupWindowDuration) { @@ -620,8 +628,10 @@ public Builder pickupWindowDuration(Nullable pickupWindowDuration) { } /** - *

The duration of time it takes to prepare this fulfillment. - * The duration must be in RFC 3339 format (for example, "P1W3D").

+ *

The duration + * needed to prepare this fulfillment. + * The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse + * "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes.

*/ @JsonSetter(value = "prep_time_duration", nulls = Nulls.SKIP) public Builder prepTimeDuration(Optional prepTimeDuration) { diff --git a/src/main/java/com/squareup/square/types/GetBankAccountResponse.java b/src/main/java/com/squareup/square/types/GetBankAccountResponse.java index 83144358..7440db4a 100644 --- a/src/main/java/com/squareup/square/types/GetBankAccountResponse.java +++ b/src/main/java/com/squareup/square/types/GetBankAccountResponse.java @@ -21,27 +21,19 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = GetBankAccountResponse.Builder.class) public final class GetBankAccountResponse { - private final Optional> errors; - private final Optional bankAccount; + private final Optional> errors; + private final Map additionalProperties; private GetBankAccountResponse( - Optional> errors, Optional bankAccount, Map additionalProperties) { - this.errors = errors; + Optional bankAccount, Optional> errors, Map additionalProperties) { this.bankAccount = bankAccount; + this.errors = errors; this.additionalProperties = additionalProperties; } - /** - * @return Information on errors encountered during the request. - */ - @JsonProperty("errors") - public Optional> getErrors() { - return errors; - } - /** * @return The requested BankAccount object. */ @@ -50,6 +42,14 @@ public Optional getBankAccount() { return bankAccount; } + /** + * @return Information on errors encountered during the request. + */ + @JsonProperty("errors") + public Optional> getErrors() { + return errors; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -62,12 +62,12 @@ public Map getAdditionalProperties() { } private boolean equalTo(GetBankAccountResponse other) { - return errors.equals(other.errors) && bankAccount.equals(other.bankAccount); + return bankAccount.equals(other.bankAccount) && errors.equals(other.errors); } @java.lang.Override public int hashCode() { - return Objects.hash(this.errors, this.bankAccount); + return Objects.hash(this.bankAccount, this.errors); } @java.lang.Override @@ -81,51 +81,51 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { - private Optional> errors = Optional.empty(); - private Optional bankAccount = Optional.empty(); + private Optional> errors = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} public Builder from(GetBankAccountResponse other) { - errors(other.getErrors()); bankAccount(other.getBankAccount()); + errors(other.getErrors()); return this; } /** - *

Information on errors encountered during the request.

+ *

The requested BankAccount object.

*/ - @JsonSetter(value = "errors", nulls = Nulls.SKIP) - public Builder errors(Optional> errors) { - this.errors = errors; + @JsonSetter(value = "bank_account", nulls = Nulls.SKIP) + public Builder bankAccount(Optional bankAccount) { + this.bankAccount = bankAccount; return this; } - public Builder errors(List errors) { - this.errors = Optional.ofNullable(errors); + public Builder bankAccount(BankAccount bankAccount) { + this.bankAccount = Optional.ofNullable(bankAccount); return this; } /** - *

The requested BankAccount object.

+ *

Information on errors encountered during the request.

*/ - @JsonSetter(value = "bank_account", nulls = Nulls.SKIP) - public Builder bankAccount(Optional bankAccount) { - this.bankAccount = bankAccount; + @JsonSetter(value = "errors", nulls = Nulls.SKIP) + public Builder errors(Optional> errors) { + this.errors = errors; return this; } - public Builder bankAccount(BankAccount bankAccount) { - this.bankAccount = Optional.ofNullable(bankAccount); + public Builder errors(List errors) { + this.errors = Optional.ofNullable(errors); return this; } public GetBankAccountResponse build() { - return new GetBankAccountResponse(errors, bankAccount, additionalProperties); + return new GetBankAccountResponse(bankAccount, errors, additionalProperties); } } } diff --git a/src/main/java/com/squareup/square/types/ListBankAccountsRequest.java b/src/main/java/com/squareup/square/types/ListBankAccountsRequest.java index 9095a453..1d63faef 100644 --- a/src/main/java/com/squareup/square/types/ListBankAccountsRequest.java +++ b/src/main/java/com/squareup/square/types/ListBankAccountsRequest.java @@ -29,16 +29,20 @@ public final class ListBankAccountsRequest { private final Optional locationId; + private final Optional customerId; + private final Map additionalProperties; private ListBankAccountsRequest( Optional cursor, Optional limit, Optional locationId, + Optional customerId, Map additionalProperties) { this.cursor = cursor; this.limit = limit; this.locationId = locationId; + this.customerId = customerId; this.additionalProperties = additionalProperties; } @@ -81,6 +85,18 @@ public Optional getLocationId() { return locationId; } + /** + * @return Customer ID. You can specify this optional filter + * to retrieve only the linked bank accounts belonging to a specific customer. + */ + @JsonIgnore + public Optional getCustomerId() { + if (customerId == null) { + return Optional.empty(); + } + return customerId; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("cursor") private Optional _getCursor() { @@ -99,6 +115,12 @@ private Optional _getLocationId() { return locationId; } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("customer_id") + private Optional _getCustomerId() { + return customerId; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -111,12 +133,15 @@ public Map getAdditionalProperties() { } private boolean equalTo(ListBankAccountsRequest other) { - return cursor.equals(other.cursor) && limit.equals(other.limit) && locationId.equals(other.locationId); + return cursor.equals(other.cursor) + && limit.equals(other.limit) + && locationId.equals(other.locationId) + && customerId.equals(other.customerId); } @java.lang.Override public int hashCode() { - return Objects.hash(this.cursor, this.limit, this.locationId); + return Objects.hash(this.cursor, this.limit, this.locationId, this.customerId); } @java.lang.Override @@ -136,6 +161,8 @@ public static final class Builder { private Optional locationId = Optional.empty(); + private Optional customerId = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -145,6 +172,7 @@ public Builder from(ListBankAccountsRequest other) { cursor(other.getCursor()); limit(other.getLimit()); locationId(other.getLocationId()); + customerId(other.getCustomerId()); return this; } @@ -229,8 +257,34 @@ public Builder locationId(Nullable locationId) { return this; } + /** + *

Customer ID. You can specify this optional filter + * to retrieve only the linked bank accounts belonging to a specific customer.

+ */ + @JsonSetter(value = "customer_id", nulls = Nulls.SKIP) + public Builder customerId(Optional customerId) { + this.customerId = customerId; + return this; + } + + public Builder customerId(String customerId) { + this.customerId = Optional.ofNullable(customerId); + return this; + } + + public Builder customerId(Nullable customerId) { + if (customerId.isNull()) { + this.customerId = null; + } else if (customerId.isEmpty()) { + this.customerId = Optional.empty(); + } else { + this.customerId = Optional.of(customerId.get()); + } + return this; + } + public ListBankAccountsRequest build() { - return new ListBankAccountsRequest(cursor, limit, locationId, additionalProperties); + return new ListBankAccountsRequest(cursor, limit, locationId, customerId, additionalProperties); } } } diff --git a/src/main/java/com/squareup/square/types/ListBankAccountsResponse.java b/src/main/java/com/squareup/square/types/ListBankAccountsResponse.java index 31fbe18b..1ef871f4 100644 --- a/src/main/java/com/squareup/square/types/ListBankAccountsResponse.java +++ b/src/main/java/com/squareup/square/types/ListBankAccountsResponse.java @@ -21,33 +21,25 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ListBankAccountsResponse.Builder.class) public final class ListBankAccountsResponse { - private final Optional> errors; - private final Optional> bankAccounts; + private final Optional> errors; + private final Optional cursor; private final Map additionalProperties; private ListBankAccountsResponse( - Optional> errors, Optional> bankAccounts, + Optional> errors, Optional cursor, Map additionalProperties) { - this.errors = errors; this.bankAccounts = bankAccounts; + this.errors = errors; this.cursor = cursor; this.additionalProperties = additionalProperties; } - /** - * @return Information on errors encountered during the request. - */ - @JsonProperty("errors") - public Optional> getErrors() { - return errors; - } - /** * @return List of BankAccounts associated with this account. */ @@ -56,6 +48,14 @@ public Optional> getBankAccounts() { return bankAccounts; } + /** + * @return Information on errors encountered during the request. + */ + @JsonProperty("errors") + public Optional> getErrors() { + return errors; + } + /** * @return When a response is truncated, it includes a cursor that you can * use in a subsequent request to fetch next set of bank accounts. @@ -79,12 +79,12 @@ public Map getAdditionalProperties() { } private boolean equalTo(ListBankAccountsResponse other) { - return errors.equals(other.errors) && bankAccounts.equals(other.bankAccounts) && cursor.equals(other.cursor); + return bankAccounts.equals(other.bankAccounts) && errors.equals(other.errors) && cursor.equals(other.cursor); } @java.lang.Override public int hashCode() { - return Objects.hash(this.errors, this.bankAccounts, this.cursor); + return Objects.hash(this.bankAccounts, this.errors, this.cursor); } @java.lang.Override @@ -98,10 +98,10 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { - private Optional> errors = Optional.empty(); - private Optional> bankAccounts = Optional.empty(); + private Optional> errors = Optional.empty(); + private Optional cursor = Optional.empty(); @JsonAnySetter @@ -110,37 +110,37 @@ public static final class Builder { private Builder() {} public Builder from(ListBankAccountsResponse other) { - errors(other.getErrors()); bankAccounts(other.getBankAccounts()); + errors(other.getErrors()); cursor(other.getCursor()); return this; } /** - *

Information on errors encountered during the request.

+ *

List of BankAccounts associated with this account.

*/ - @JsonSetter(value = "errors", nulls = Nulls.SKIP) - public Builder errors(Optional> errors) { - this.errors = errors; + @JsonSetter(value = "bank_accounts", nulls = Nulls.SKIP) + public Builder bankAccounts(Optional> bankAccounts) { + this.bankAccounts = bankAccounts; return this; } - public Builder errors(List errors) { - this.errors = Optional.ofNullable(errors); + public Builder bankAccounts(List bankAccounts) { + this.bankAccounts = Optional.ofNullable(bankAccounts); return this; } /** - *

List of BankAccounts associated with this account.

+ *

Information on errors encountered during the request.

*/ - @JsonSetter(value = "bank_accounts", nulls = Nulls.SKIP) - public Builder bankAccounts(Optional> bankAccounts) { - this.bankAccounts = bankAccounts; + @JsonSetter(value = "errors", nulls = Nulls.SKIP) + public Builder errors(Optional> errors) { + this.errors = errors; return this; } - public Builder bankAccounts(List bankAccounts) { - this.bankAccounts = Optional.ofNullable(bankAccounts); + public Builder errors(List errors) { + this.errors = Optional.ofNullable(errors); return this; } @@ -162,7 +162,7 @@ public Builder cursor(String cursor) { } public ListBankAccountsResponse build() { - return new ListBankAccountsResponse(errors, bankAccounts, cursor, additionalProperties); + return new ListBankAccountsResponse(bankAccounts, errors, cursor, additionalProperties); } } } diff --git a/src/main/java/com/squareup/square/types/ObtainTokenRequest.java b/src/main/java/com/squareup/square/types/ObtainTokenRequest.java index 5ef0d9c6..2d3e4f6f 100644 --- a/src/main/java/com/squareup/square/types/ObtainTokenRequest.java +++ b/src/main/java/com/squareup/square/types/ObtainTokenRequest.java @@ -45,6 +45,8 @@ public final class ObtainTokenRequest { private final Optional codeVerifier; + private final Optional useJwt; + private final Map additionalProperties; private ObtainTokenRequest( @@ -58,6 +60,7 @@ private ObtainTokenRequest( Optional> scopes, Optional shortLived, Optional codeVerifier, + Optional useJwt, Map additionalProperties) { this.clientId = clientId; this.clientSecret = clientSecret; @@ -69,6 +72,7 @@ private ObtainTokenRequest( this.scopes = scopes; this.shortLived = shortLived; this.codeVerifier = codeVerifier; + this.useJwt = useJwt; this.additionalProperties = additionalProperties; } @@ -206,6 +210,19 @@ public Optional getCodeVerifier() { return codeVerifier; } + /** + * @return Indicates whether to use a JWT (JSON Web Token) as the OAuth access token. + * When set to true, the OAuth flow returns a JWT to your application, used in the + * same way as a regular token. The default value is false. + */ + @JsonIgnore + public Optional getUseJwt() { + if (useJwt == null) { + return Optional.empty(); + } + return useJwt; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("client_secret") private Optional _getClientSecret() { @@ -254,6 +271,12 @@ private Optional _getCodeVerifier() { return codeVerifier; } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("use_jwt") + private Optional _getUseJwt() { + return useJwt; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -275,7 +298,8 @@ private boolean equalTo(ObtainTokenRequest other) { && migrationToken.equals(other.migrationToken) && scopes.equals(other.scopes) && shortLived.equals(other.shortLived) - && codeVerifier.equals(other.codeVerifier); + && codeVerifier.equals(other.codeVerifier) + && useJwt.equals(other.useJwt); } @java.lang.Override @@ -290,7 +314,8 @@ public int hashCode() { this.migrationToken, this.scopes, this.shortLived, - this.codeVerifier); + this.codeVerifier, + this.useJwt); } @java.lang.Override @@ -422,6 +447,17 @@ public interface _FinalStage { _FinalStage codeVerifier(String codeVerifier); _FinalStage codeVerifier(Nullable codeVerifier); + + /** + *

Indicates whether to use a JWT (JSON Web Token) as the OAuth access token. + * When set to true, the OAuth flow returns a JWT to your application, used in the + * same way as a regular token. The default value is false.

+ */ + _FinalStage useJwt(Optional useJwt); + + _FinalStage useJwt(Boolean useJwt); + + _FinalStage useJwt(Nullable useJwt); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -430,6 +466,8 @@ public static final class Builder implements ClientIdStage, GrantTypeStage, _Fin private String grantType; + private Optional useJwt = Optional.empty(); + private Optional codeVerifier = Optional.empty(); private Optional shortLived = Optional.empty(); @@ -463,6 +501,7 @@ public Builder from(ObtainTokenRequest other) { scopes(other.getScopes()); shortLived(other.getShortLived()); codeVerifier(other.getCodeVerifier()); + useJwt(other.getUseJwt()); return this; } @@ -508,6 +547,48 @@ public _FinalStage grantType(@NotNull String grantType) { return this; } + /** + *

Indicates whether to use a JWT (JSON Web Token) as the OAuth access token. + * When set to true, the OAuth flow returns a JWT to your application, used in the + * same way as a regular token. The default value is false.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage useJwt(Nullable useJwt) { + if (useJwt.isNull()) { + this.useJwt = null; + } else if (useJwt.isEmpty()) { + this.useJwt = Optional.empty(); + } else { + this.useJwt = Optional.of(useJwt.get()); + } + return this; + } + + /** + *

Indicates whether to use a JWT (JSON Web Token) as the OAuth access token. + * When set to true, the OAuth flow returns a JWT to your application, used in the + * same way as a regular token. The default value is false.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage useJwt(Boolean useJwt) { + this.useJwt = Optional.ofNullable(useJwt); + return this; + } + + /** + *

Indicates whether to use a JWT (JSON Web Token) as the OAuth access token. + * When set to true, the OAuth flow returns a JWT to your application, used in the + * same way as a regular token. The default value is false.

+ */ + @java.lang.Override + @JsonSetter(value = "use_jwt", nulls = Nulls.SKIP) + public _FinalStage useJwt(Optional useJwt) { + this.useJwt = useJwt; + return this; + } + /** *

The secret your application generated for the authorization request used to * obtain the authorization code. This is the source of the code_challenge hash you @@ -872,6 +953,7 @@ public ObtainTokenRequest build() { scopes, shortLived, codeVerifier, + useJwt, additionalProperties); } } diff --git a/src/main/java/com/squareup/square/types/OrderCardSurchargeTreatmentType.java b/src/main/java/com/squareup/square/types/OrderCardSurchargeTreatmentType.java new file mode 100644 index 00000000..d78f6b8e --- /dev/null +++ b/src/main/java/com/squareup/square/types/OrderCardSurchargeTreatmentType.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.squareup.square.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class OrderCardSurchargeTreatmentType { + public static final OrderCardSurchargeTreatmentType APPORTIONED_TREATMENT = + new OrderCardSurchargeTreatmentType(Value.APPORTIONED_TREATMENT, "APPORTIONED_TREATMENT"); + + public static final OrderCardSurchargeTreatmentType LINE_ITEM_TREATMENT = + new OrderCardSurchargeTreatmentType(Value.LINE_ITEM_TREATMENT, "LINE_ITEM_TREATMENT"); + + private final Value value; + + private final String string; + + OrderCardSurchargeTreatmentType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof OrderCardSurchargeTreatmentType + && this.string.equals(((OrderCardSurchargeTreatmentType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case APPORTIONED_TREATMENT: + return visitor.visitApportionedTreatment(); + case LINE_ITEM_TREATMENT: + return visitor.visitLineItemTreatment(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static OrderCardSurchargeTreatmentType valueOf(String value) { + switch (value) { + case "APPORTIONED_TREATMENT": + return APPORTIONED_TREATMENT; + case "LINE_ITEM_TREATMENT": + return LINE_ITEM_TREATMENT; + default: + return new OrderCardSurchargeTreatmentType(Value.UNKNOWN, value); + } + } + + public enum Value { + LINE_ITEM_TREATMENT, + + APPORTIONED_TREATMENT, + + UNKNOWN + } + + public interface Visitor { + T visitLineItemTreatment(); + + T visitApportionedTreatment(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/squareup/square/types/OrderLineItem.java b/src/main/java/com/squareup/square/types/OrderLineItem.java index 1a3aedec..58cc464b 100644 --- a/src/main/java/com/squareup/square/types/OrderLineItem.java +++ b/src/main/java/com/squareup/square/types/OrderLineItem.java @@ -305,7 +305,8 @@ public Optional> getAppliedServiceCharge } /** - * @return The base price for a single unit of the line item. + * @return The base price for a single unit of the line item. Note - If inclusive tax is set on + * this item it will be included in this value. */ @JsonProperty("base_price_money") public Optional getBasePriceMoney() { @@ -315,7 +316,8 @@ public Optional getBasePriceMoney() { /** * @return The total price of all item variations sold in this line item. * The price is calculated as base_price_money multiplied by quantity. - * It does not include modifiers. + * It does not include modifiers. Note - If inclusive tax is set on + * this item it will be included in this value. */ @JsonProperty("variation_total_price_money") public Optional getVariationTotalPriceMoney() { @@ -678,7 +680,8 @@ public interface _FinalStage { _FinalStage appliedServiceCharges(Nullable> appliedServiceCharges); /** - *

The base price for a single unit of the line item.

+ *

The base price for a single unit of the line item. Note - If inclusive tax is set on + * this item it will be included in this value.

*/ _FinalStage basePriceMoney(Optional basePriceMoney); @@ -687,7 +690,8 @@ public interface _FinalStage { /** *

The total price of all item variations sold in this line item. * The price is calculated as base_price_money multiplied by quantity. - * It does not include modifiers.

+ * It does not include modifiers. Note - If inclusive tax is set on + * this item it will be included in this value.

*/ _FinalStage variationTotalPriceMoney(Optional variationTotalPriceMoney); @@ -974,7 +978,8 @@ public _FinalStage grossSalesMoney(Optional grossSalesMoney) { /** *

The total price of all item variations sold in this line item. * The price is calculated as base_price_money multiplied by quantity. - * It does not include modifiers.

+ * It does not include modifiers. Note - If inclusive tax is set on + * this item it will be included in this value.

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -986,7 +991,8 @@ public _FinalStage variationTotalPriceMoney(Money variationTotalPriceMoney) { /** *

The total price of all item variations sold in this line item. * The price is calculated as base_price_money multiplied by quantity. - * It does not include modifiers.

+ * It does not include modifiers. Note - If inclusive tax is set on + * this item it will be included in this value.

*/ @java.lang.Override @JsonSetter(value = "variation_total_price_money", nulls = Nulls.SKIP) @@ -996,7 +1002,8 @@ public _FinalStage variationTotalPriceMoney(Optional variationTotalPriceM } /** - *

The base price for a single unit of the line item.

+ *

The base price for a single unit of the line item. Note - If inclusive tax is set on + * this item it will be included in this value.

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -1006,7 +1013,8 @@ public _FinalStage basePriceMoney(Money basePriceMoney) { } /** - *

The base price for a single unit of the line item.

+ *

The base price for a single unit of the line item. Note - If inclusive tax is set on + * this item it will be included in this value.

*/ @java.lang.Override @JsonSetter(value = "base_price_money", nulls = Nulls.SKIP) diff --git a/src/main/java/com/squareup/square/types/OrderLineItemAppliedTax.java b/src/main/java/com/squareup/square/types/OrderLineItemAppliedTax.java index 1f78124e..99859982 100644 --- a/src/main/java/com/squareup/square/types/OrderLineItemAppliedTax.java +++ b/src/main/java/com/squareup/square/types/OrderLineItemAppliedTax.java @@ -30,16 +30,20 @@ public final class OrderLineItemAppliedTax { private final Optional appliedMoney; + private final Optional autoApplied; + private final Map additionalProperties; private OrderLineItemAppliedTax( Optional uid, String taxUid, Optional appliedMoney, + Optional autoApplied, Map additionalProperties) { this.uid = uid; this.taxUid = taxUid; this.appliedMoney = appliedMoney; + this.autoApplied = autoApplied; this.additionalProperties = additionalProperties; } @@ -73,6 +77,16 @@ public Optional getAppliedMoney() { return appliedMoney; } + /** + * @return Indicates whether the tax was automatically applied to the order based on + * the catalog configuration. For an example, see + * Automatically Apply Taxes to an Order. + */ + @JsonProperty("auto_applied") + public Optional getAutoApplied() { + return autoApplied; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("uid") private Optional _getUid() { @@ -91,12 +105,15 @@ public Map getAdditionalProperties() { } private boolean equalTo(OrderLineItemAppliedTax other) { - return uid.equals(other.uid) && taxUid.equals(other.taxUid) && appliedMoney.equals(other.appliedMoney); + return uid.equals(other.uid) + && taxUid.equals(other.taxUid) + && appliedMoney.equals(other.appliedMoney) + && autoApplied.equals(other.autoApplied); } @java.lang.Override public int hashCode() { - return Objects.hash(this.uid, this.taxUid, this.appliedMoney); + return Objects.hash(this.uid, this.taxUid, this.appliedMoney, this.autoApplied); } @java.lang.Override @@ -138,12 +155,23 @@ public interface _FinalStage { _FinalStage appliedMoney(Optional appliedMoney); _FinalStage appliedMoney(Money appliedMoney); + + /** + *

Indicates whether the tax was automatically applied to the order based on + * the catalog configuration. For an example, see + * Automatically Apply Taxes to an Order.

+ */ + _FinalStage autoApplied(Optional autoApplied); + + _FinalStage autoApplied(Boolean autoApplied); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements TaxUidStage, _FinalStage { private String taxUid; + private Optional autoApplied = Optional.empty(); + private Optional appliedMoney = Optional.empty(); private Optional uid = Optional.empty(); @@ -158,6 +186,7 @@ public Builder from(OrderLineItemAppliedTax other) { uid(other.getUid()); taxUid(other.getTaxUid()); appliedMoney(other.getAppliedMoney()); + autoApplied(other.getAutoApplied()); return this; } @@ -179,6 +208,30 @@ public _FinalStage taxUid(@NotNull String taxUid) { return this; } + /** + *

Indicates whether the tax was automatically applied to the order based on + * the catalog configuration. For an example, see + * Automatically Apply Taxes to an Order.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage autoApplied(Boolean autoApplied) { + this.autoApplied = Optional.ofNullable(autoApplied); + return this; + } + + /** + *

Indicates whether the tax was automatically applied to the order based on + * the catalog configuration. For an example, see + * Automatically Apply Taxes to an Order.

+ */ + @java.lang.Override + @JsonSetter(value = "auto_applied", nulls = Nulls.SKIP) + public _FinalStage autoApplied(Optional autoApplied) { + this.autoApplied = autoApplied; + return this; + } + /** *

The amount of money applied by the tax to the line item.

* @return Reference to {@code this} so that method calls can be chained together. @@ -237,7 +290,7 @@ public _FinalStage uid(Optional uid) { @java.lang.Override public OrderLineItemAppliedTax build() { - return new OrderLineItemAppliedTax(uid, taxUid, appliedMoney, additionalProperties); + return new OrderLineItemAppliedTax(uid, taxUid, appliedMoney, autoApplied, additionalProperties); } } } diff --git a/src/main/java/com/squareup/square/types/OrderLineItemPricingBlocklists.java b/src/main/java/com/squareup/square/types/OrderLineItemPricingBlocklists.java index 43bc76c2..a77923e3 100644 --- a/src/main/java/com/squareup/square/types/OrderLineItemPricingBlocklists.java +++ b/src/main/java/com/squareup/square/types/OrderLineItemPricingBlocklists.java @@ -28,14 +28,18 @@ public final class OrderLineItemPricingBlocklists { private final Optional> blockedTaxes; + private final Optional> blockedServiceCharges; + private final Map additionalProperties; private OrderLineItemPricingBlocklists( Optional> blockedDiscounts, Optional> blockedTaxes, + Optional> blockedServiceCharges, Map additionalProperties) { this.blockedDiscounts = blockedDiscounts; this.blockedTaxes = blockedTaxes; + this.blockedServiceCharges = blockedServiceCharges; this.additionalProperties = additionalProperties; } @@ -65,6 +69,20 @@ public Optional> getBlockedTaxes( return blockedTaxes; } + /** + * @return A list of service charges blocked from applying to the line item. + * Service charges can be blocked by the service_charge_uid (for ad hoc + * service charges) or the service_charge_catalog_object_id (for catalog + * service charges). + */ + @JsonIgnore + public Optional> getBlockedServiceCharges() { + if (blockedServiceCharges == null) { + return Optional.empty(); + } + return blockedServiceCharges; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("blocked_discounts") private Optional> _getBlockedDiscounts() { @@ -77,6 +95,12 @@ private Optional> _getBlockedTaxe return blockedTaxes; } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("blocked_service_charges") + private Optional> _getBlockedServiceCharges() { + return blockedServiceCharges; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -89,12 +113,14 @@ public Map getAdditionalProperties() { } private boolean equalTo(OrderLineItemPricingBlocklists other) { - return blockedDiscounts.equals(other.blockedDiscounts) && blockedTaxes.equals(other.blockedTaxes); + return blockedDiscounts.equals(other.blockedDiscounts) + && blockedTaxes.equals(other.blockedTaxes) + && blockedServiceCharges.equals(other.blockedServiceCharges); } @java.lang.Override public int hashCode() { - return Objects.hash(this.blockedDiscounts, this.blockedTaxes); + return Objects.hash(this.blockedDiscounts, this.blockedTaxes, this.blockedServiceCharges); } @java.lang.Override @@ -112,6 +138,9 @@ public static final class Builder { private Optional> blockedTaxes = Optional.empty(); + private Optional> blockedServiceCharges = + Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -120,6 +149,7 @@ private Builder() {} public Builder from(OrderLineItemPricingBlocklists other) { blockedDiscounts(other.getBlockedDiscounts()); blockedTaxes(other.getBlockedTaxes()); + blockedServiceCharges(other.getBlockedServiceCharges()); return this; } @@ -179,8 +209,40 @@ public Builder blockedTaxes(NullableA list of service charges blocked from applying to the line item. + * Service charges can be blocked by the service_charge_uid (for ad hoc + * service charges) or the service_charge_catalog_object_id (for catalog + * service charges).

+ */ + @JsonSetter(value = "blocked_service_charges", nulls = Nulls.SKIP) + public Builder blockedServiceCharges( + Optional> blockedServiceCharges) { + this.blockedServiceCharges = blockedServiceCharges; + return this; + } + + public Builder blockedServiceCharges( + List blockedServiceCharges) { + this.blockedServiceCharges = Optional.ofNullable(blockedServiceCharges); + return this; + } + + public Builder blockedServiceCharges( + Nullable> blockedServiceCharges) { + if (blockedServiceCharges.isNull()) { + this.blockedServiceCharges = null; + } else if (blockedServiceCharges.isEmpty()) { + this.blockedServiceCharges = Optional.empty(); + } else { + this.blockedServiceCharges = Optional.of(blockedServiceCharges.get()); + } + return this; + } + public OrderLineItemPricingBlocklists build() { - return new OrderLineItemPricingBlocklists(blockedDiscounts, blockedTaxes, additionalProperties); + return new OrderLineItemPricingBlocklists( + blockedDiscounts, blockedTaxes, blockedServiceCharges, additionalProperties); } } } diff --git a/src/main/java/com/squareup/square/types/OrderLineItemPricingBlocklistsBlockedServiceCharge.java b/src/main/java/com/squareup/square/types/OrderLineItemPricingBlocklistsBlockedServiceCharge.java new file mode 100644 index 00000000..03218792 --- /dev/null +++ b/src/main/java/com/squareup/square/types/OrderLineItemPricingBlocklistsBlockedServiceCharge.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.squareup.square.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.squareup.square.core.Nullable; +import com.squareup.square.core.NullableNonemptyFilter; +import com.squareup.square.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = OrderLineItemPricingBlocklistsBlockedServiceCharge.Builder.class) +public final class OrderLineItemPricingBlocklistsBlockedServiceCharge { + private final Optional uid; + + private final Optional serviceChargeUid; + + private final Optional serviceChargeCatalogObjectId; + + private final Map additionalProperties; + + private OrderLineItemPricingBlocklistsBlockedServiceCharge( + Optional uid, + Optional serviceChargeUid, + Optional serviceChargeCatalogObjectId, + Map additionalProperties) { + this.uid = uid; + this.serviceChargeUid = serviceChargeUid; + this.serviceChargeCatalogObjectId = serviceChargeCatalogObjectId; + this.additionalProperties = additionalProperties; + } + + /** + * @return A unique ID of the BlockedServiceCharge within the order. + */ + @JsonIgnore + public Optional getUid() { + if (uid == null) { + return Optional.empty(); + } + return uid; + } + + /** + * @return The uid of the service charge that should be blocked. Use this field to + * block ad hoc service charges. For catalog service charges, use the + * service_charge_catalog_object_id field. + */ + @JsonIgnore + public Optional getServiceChargeUid() { + if (serviceChargeUid == null) { + return Optional.empty(); + } + return serviceChargeUid; + } + + /** + * @return The catalog_object_id of the service charge that should be blocked. + * Use this field to block catalog service charges. For ad hoc service charges, + * use the service_charge_uid field. + */ + @JsonIgnore + public Optional getServiceChargeCatalogObjectId() { + if (serviceChargeCatalogObjectId == null) { + return Optional.empty(); + } + return serviceChargeCatalogObjectId; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("uid") + private Optional _getUid() { + return uid; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("service_charge_uid") + private Optional _getServiceChargeUid() { + return serviceChargeUid; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("service_charge_catalog_object_id") + private Optional _getServiceChargeCatalogObjectId() { + return serviceChargeCatalogObjectId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OrderLineItemPricingBlocklistsBlockedServiceCharge + && equalTo((OrderLineItemPricingBlocklistsBlockedServiceCharge) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(OrderLineItemPricingBlocklistsBlockedServiceCharge other) { + return uid.equals(other.uid) + && serviceChargeUid.equals(other.serviceChargeUid) + && serviceChargeCatalogObjectId.equals(other.serviceChargeCatalogObjectId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.uid, this.serviceChargeUid, this.serviceChargeCatalogObjectId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional uid = Optional.empty(); + + private Optional serviceChargeUid = Optional.empty(); + + private Optional serviceChargeCatalogObjectId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(OrderLineItemPricingBlocklistsBlockedServiceCharge other) { + uid(other.getUid()); + serviceChargeUid(other.getServiceChargeUid()); + serviceChargeCatalogObjectId(other.getServiceChargeCatalogObjectId()); + return this; + } + + /** + *

A unique ID of the BlockedServiceCharge within the order.

+ */ + @JsonSetter(value = "uid", nulls = Nulls.SKIP) + public Builder uid(Optional uid) { + this.uid = uid; + return this; + } + + public Builder uid(String uid) { + this.uid = Optional.ofNullable(uid); + return this; + } + + public Builder uid(Nullable uid) { + if (uid.isNull()) { + this.uid = null; + } else if (uid.isEmpty()) { + this.uid = Optional.empty(); + } else { + this.uid = Optional.of(uid.get()); + } + return this; + } + + /** + *

The uid of the service charge that should be blocked. Use this field to + * block ad hoc service charges. For catalog service charges, use the + * service_charge_catalog_object_id field.

+ */ + @JsonSetter(value = "service_charge_uid", nulls = Nulls.SKIP) + public Builder serviceChargeUid(Optional serviceChargeUid) { + this.serviceChargeUid = serviceChargeUid; + return this; + } + + public Builder serviceChargeUid(String serviceChargeUid) { + this.serviceChargeUid = Optional.ofNullable(serviceChargeUid); + return this; + } + + public Builder serviceChargeUid(Nullable serviceChargeUid) { + if (serviceChargeUid.isNull()) { + this.serviceChargeUid = null; + } else if (serviceChargeUid.isEmpty()) { + this.serviceChargeUid = Optional.empty(); + } else { + this.serviceChargeUid = Optional.of(serviceChargeUid.get()); + } + return this; + } + + /** + *

The catalog_object_id of the service charge that should be blocked. + * Use this field to block catalog service charges. For ad hoc service charges, + * use the service_charge_uid field.

+ */ + @JsonSetter(value = "service_charge_catalog_object_id", nulls = Nulls.SKIP) + public Builder serviceChargeCatalogObjectId(Optional serviceChargeCatalogObjectId) { + this.serviceChargeCatalogObjectId = serviceChargeCatalogObjectId; + return this; + } + + public Builder serviceChargeCatalogObjectId(String serviceChargeCatalogObjectId) { + this.serviceChargeCatalogObjectId = Optional.ofNullable(serviceChargeCatalogObjectId); + return this; + } + + public Builder serviceChargeCatalogObjectId(Nullable serviceChargeCatalogObjectId) { + if (serviceChargeCatalogObjectId.isNull()) { + this.serviceChargeCatalogObjectId = null; + } else if (serviceChargeCatalogObjectId.isEmpty()) { + this.serviceChargeCatalogObjectId = Optional.empty(); + } else { + this.serviceChargeCatalogObjectId = Optional.of(serviceChargeCatalogObjectId.get()); + } + return this; + } + + public OrderLineItemPricingBlocklistsBlockedServiceCharge build() { + return new OrderLineItemPricingBlocklistsBlockedServiceCharge( + uid, serviceChargeUid, serviceChargeCatalogObjectId, additionalProperties); + } + } +} diff --git a/src/main/java/com/squareup/square/types/OrderReturn.java b/src/main/java/com/squareup/square/types/OrderReturn.java index acc9558a..064517f6 100644 --- a/src/main/java/com/squareup/square/types/OrderReturn.java +++ b/src/main/java/com/squareup/square/types/OrderReturn.java @@ -117,8 +117,11 @@ public Optional> getReturnServiceCharges() { * applied tax amount to be returned. The taxes must reference a top-level tax ID from the source * order. */ - @JsonProperty("return_taxes") + @JsonIgnore public Optional> getReturnTaxes() { + if (returnTaxes == null) { + return Optional.empty(); + } return returnTaxes; } @@ -127,8 +130,11 @@ public Optional> getReturnTaxes() { * applied discount amount to be returned. The discounts must reference a top-level discount ID * from the source order. */ - @JsonProperty("return_discounts") + @JsonIgnore public Optional> getReturnDiscounts() { + if (returnDiscounts == null) { + return Optional.empty(); + } return returnDiscounts; } @@ -185,6 +191,18 @@ private Optional> _getReturnServiceCharges() { return returnServiceCharges; } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("return_taxes") + private Optional> _getReturnTaxes() { + return returnTaxes; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("return_discounts") + private Optional> _getReturnDiscounts() { + return returnDiscounts; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("return_tips") private Optional> _getReturnTips() { @@ -392,6 +410,17 @@ public Builder returnTaxes(List returnTaxes) { return this; } + public Builder returnTaxes(Nullable> returnTaxes) { + if (returnTaxes.isNull()) { + this.returnTaxes = null; + } else if (returnTaxes.isEmpty()) { + this.returnTaxes = Optional.empty(); + } else { + this.returnTaxes = Optional.of(returnTaxes.get()); + } + return this; + } + /** *

A collection of references to discounts being returned for an order, including the total * applied discount amount to be returned. The discounts must reference a top-level discount ID @@ -408,6 +437,17 @@ public Builder returnDiscounts(List returnDiscounts) { return this; } + public Builder returnDiscounts(Nullable> returnDiscounts) { + if (returnDiscounts.isNull()) { + this.returnDiscounts = null; + } else if (returnDiscounts.isEmpty()) { + this.returnDiscounts = Optional.empty(); + } else { + this.returnDiscounts = Optional.of(returnDiscounts.get()); + } + return this; + } + /** *

A collection of references to tips being returned for an order.

*/ diff --git a/src/main/java/com/squareup/square/types/OrderReturnServiceCharge.java b/src/main/java/com/squareup/square/types/OrderReturnServiceCharge.java index cef0061a..bb89e8a6 100644 --- a/src/main/java/com/squareup/square/types/OrderReturnServiceCharge.java +++ b/src/main/java/com/squareup/square/types/OrderReturnServiceCharge.java @@ -54,6 +54,8 @@ public final class OrderReturnServiceCharge { private final Optional scope; + private final Optional type; + private final Map additionalProperties; private OrderReturnServiceCharge( @@ -72,6 +74,7 @@ private OrderReturnServiceCharge( Optional> appliedTaxes, Optional treatmentType, Optional scope, + Optional type, Map additionalProperties) { this.uid = uid; this.sourceServiceChargeUid = sourceServiceChargeUid; @@ -88,6 +91,7 @@ private OrderReturnServiceCharge( this.appliedTaxes = appliedTaxes; this.treatmentType = treatmentType; this.scope = scope; + this.type = type; this.additionalProperties = additionalProperties; } @@ -240,7 +244,7 @@ public Optional> getAppliedTaxes() { } /** - * @return The treatment type of the service charge. + * @return Indicates whether the service charge will be treated as a value-holding line item or apportioned toward a line item. * See OrderServiceChargeTreatmentType for possible values */ @JsonProperty("treatment_type") @@ -263,6 +267,15 @@ public Optional getScope() { return scope; } + /** + * @return The type of the service charge. + * See OrderServiceChargeType for possible values + */ + @JsonProperty("type") + public Optional getType() { + return type; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("uid") private Optional _getUid() { @@ -337,7 +350,8 @@ private boolean equalTo(OrderReturnServiceCharge other) { && taxable.equals(other.taxable) && appliedTaxes.equals(other.appliedTaxes) && treatmentType.equals(other.treatmentType) - && scope.equals(other.scope); + && scope.equals(other.scope) + && type.equals(other.type); } @java.lang.Override @@ -357,7 +371,8 @@ public int hashCode() { this.taxable, this.appliedTaxes, this.treatmentType, - this.scope); + this.scope, + this.type); } @java.lang.Override @@ -401,6 +416,8 @@ public static final class Builder { private Optional scope = Optional.empty(); + private Optional type = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -422,6 +439,7 @@ public Builder from(OrderReturnServiceCharge other) { appliedTaxes(other.getAppliedTaxes()); treatmentType(other.getTreatmentType()); scope(other.getScope()); + type(other.getType()); return this; } @@ -716,7 +734,7 @@ public Builder appliedTaxes(Nullable> appliedTaxes } /** - *

The treatment type of the service charge. + *

Indicates whether the service charge will be treated as a value-holding line item or apportioned toward a line item. * See OrderServiceChargeTreatmentType for possible values

*/ @JsonSetter(value = "treatment_type", nulls = Nulls.SKIP) @@ -751,6 +769,21 @@ public Builder scope(OrderServiceChargeScope scope) { return this; } + /** + *

The type of the service charge. + * See OrderServiceChargeType for possible values

+ */ + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(OrderServiceChargeType type) { + this.type = Optional.ofNullable(type); + return this; + } + public OrderReturnServiceCharge build() { return new OrderReturnServiceCharge( uid, @@ -768,6 +801,7 @@ public OrderReturnServiceCharge build() { appliedTaxes, treatmentType, scope, + type, additionalProperties); } } diff --git a/src/main/java/com/squareup/square/types/OrderServiceCharge.java b/src/main/java/com/squareup/square/types/OrderServiceCharge.java index 3456afa5..5412d6c0 100644 --- a/src/main/java/com/squareup/square/types/OrderServiceCharge.java +++ b/src/main/java/com/squareup/square/types/OrderServiceCharge.java @@ -107,7 +107,7 @@ public Optional getUid() { } /** - * @return The name of the service charge. + * @return The name of the service charge. This is unused and null for AUTO_GRATUITY to match the behavior on Bills. */ @JsonIgnore public Optional getName() { @@ -270,7 +270,7 @@ public Optional getType() { } /** - * @return The treatment type of the service charge. + * @return Indicates whether the service charge will be treated as a value-holding line item or apportioned toward a line item. * See OrderServiceChargeTreatmentType for possible values */ @JsonProperty("treatment_type") @@ -486,7 +486,7 @@ public Builder uid(Nullable uid) { } /** - *

The name of the service charge.

+ *

The name of the service charge. This is unused and null for AUTO_GRATUITY to match the behavior on Bills.

*/ @JsonSetter(value = "name", nulls = Nulls.SKIP) public Builder name(Optional name) { @@ -783,7 +783,7 @@ public Builder type(OrderServiceChargeType type) { } /** - *

The treatment type of the service charge. + *

Indicates whether the service charge will be treated as a value-holding line item or apportioned toward a line item. * See OrderServiceChargeTreatmentType for possible values

*/ @JsonSetter(value = "treatment_type", nulls = Nulls.SKIP) diff --git a/src/main/java/com/squareup/square/types/SearchOrdersSourceFilter.java b/src/main/java/com/squareup/square/types/SearchOrdersSourceFilter.java index 4b45e59c..d89b2aab 100644 --- a/src/main/java/com/squareup/square/types/SearchOrdersSourceFilter.java +++ b/src/main/java/com/squareup/square/types/SearchOrdersSourceFilter.java @@ -26,10 +26,20 @@ public final class SearchOrdersSourceFilter { private final Optional> sourceNames; + private final Optional> sourceApplicationIds; + + private final Optional> sourceClientOus; + private final Map additionalProperties; - private SearchOrdersSourceFilter(Optional> sourceNames, Map additionalProperties) { + private SearchOrdersSourceFilter( + Optional> sourceNames, + Optional> sourceApplicationIds, + Optional> sourceClientOus, + Map additionalProperties) { this.sourceNames = sourceNames; + this.sourceApplicationIds = sourceApplicationIds; + this.sourceClientOus = sourceClientOus; this.additionalProperties = additionalProperties; } @@ -46,12 +56,50 @@ public Optional> getSourceNames() { return sourceNames; } + /** + * @return Filters by the Source applicationId. The filter returns any orders + * with a source.applicationId that matches any of the listed source applicationIds. + *

Max: 100 source applicationIds.

+ */ + @JsonIgnore + public Optional> getSourceApplicationIds() { + if (sourceApplicationIds == null) { + return Optional.empty(); + } + return sourceApplicationIds; + } + + /** + * @return Filters by the Source clientOu. The filter returns any orders + * with a source.clientOu that matches any of the listed source clientOus. + *

Max: 100 source clientOus.

+ */ + @JsonIgnore + public Optional> getSourceClientOus() { + if (sourceClientOus == null) { + return Optional.empty(); + } + return sourceClientOus; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("source_names") private Optional> _getSourceNames() { return sourceNames; } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("source_application_ids") + private Optional> _getSourceApplicationIds() { + return sourceApplicationIds; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("source_client_ous") + private Optional> _getSourceClientOus() { + return sourceClientOus; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -64,12 +112,14 @@ public Map getAdditionalProperties() { } private boolean equalTo(SearchOrdersSourceFilter other) { - return sourceNames.equals(other.sourceNames); + return sourceNames.equals(other.sourceNames) + && sourceApplicationIds.equals(other.sourceApplicationIds) + && sourceClientOus.equals(other.sourceClientOus); } @java.lang.Override public int hashCode() { - return Objects.hash(this.sourceNames); + return Objects.hash(this.sourceNames, this.sourceApplicationIds, this.sourceClientOus); } @java.lang.Override @@ -85,6 +135,10 @@ public static Builder builder() { public static final class Builder { private Optional> sourceNames = Optional.empty(); + private Optional> sourceApplicationIds = Optional.empty(); + + private Optional> sourceClientOus = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -92,6 +146,8 @@ private Builder() {} public Builder from(SearchOrdersSourceFilter other) { sourceNames(other.getSourceNames()); + sourceApplicationIds(other.getSourceApplicationIds()); + sourceClientOus(other.getSourceClientOus()); return this; } @@ -122,8 +178,63 @@ public Builder sourceNames(Nullable> sourceNames) { return this; } + /** + *

Filters by the Source applicationId. The filter returns any orders + * with a source.applicationId that matches any of the listed source applicationIds.

+ *

Max: 100 source applicationIds.

+ */ + @JsonSetter(value = "source_application_ids", nulls = Nulls.SKIP) + public Builder sourceApplicationIds(Optional> sourceApplicationIds) { + this.sourceApplicationIds = sourceApplicationIds; + return this; + } + + public Builder sourceApplicationIds(List sourceApplicationIds) { + this.sourceApplicationIds = Optional.ofNullable(sourceApplicationIds); + return this; + } + + public Builder sourceApplicationIds(Nullable> sourceApplicationIds) { + if (sourceApplicationIds.isNull()) { + this.sourceApplicationIds = null; + } else if (sourceApplicationIds.isEmpty()) { + this.sourceApplicationIds = Optional.empty(); + } else { + this.sourceApplicationIds = Optional.of(sourceApplicationIds.get()); + } + return this; + } + + /** + *

Filters by the Source clientOu. The filter returns any orders + * with a source.clientOu that matches any of the listed source clientOus.

+ *

Max: 100 source clientOus.

+ */ + @JsonSetter(value = "source_client_ous", nulls = Nulls.SKIP) + public Builder sourceClientOus(Optional> sourceClientOus) { + this.sourceClientOus = sourceClientOus; + return this; + } + + public Builder sourceClientOus(List sourceClientOus) { + this.sourceClientOus = Optional.ofNullable(sourceClientOus); + return this; + } + + public Builder sourceClientOus(Nullable> sourceClientOus) { + if (sourceClientOus.isNull()) { + this.sourceClientOus = null; + } else if (sourceClientOus.isEmpty()) { + this.sourceClientOus = Optional.empty(); + } else { + this.sourceClientOus = Optional.of(sourceClientOus.get()); + } + return this; + } + public SearchOrdersSourceFilter build() { - return new SearchOrdersSourceFilter(sourceNames, additionalProperties); + return new SearchOrdersSourceFilter( + sourceNames, sourceApplicationIds, sourceClientOus, additionalProperties); } } } diff --git a/src/main/java/com/squareup/square/types/SubscriptionTestResult.java b/src/main/java/com/squareup/square/types/SubscriptionTestResult.java index 387b6ebe..4e8d09fd 100644 --- a/src/main/java/com/squareup/square/types/SubscriptionTestResult.java +++ b/src/main/java/com/squareup/square/types/SubscriptionTestResult.java @@ -27,26 +27,34 @@ public final class SubscriptionTestResult { private final Optional statusCode; - private final Optional payload; + private final Optional> payload; private final Optional createdAt; private final Optional updatedAt; + private final Optional notificationUrl; + + private final Optional passesFilter; + private final Map additionalProperties; private SubscriptionTestResult( Optional id, Optional statusCode, - Optional payload, + Optional> payload, Optional createdAt, Optional updatedAt, + Optional notificationUrl, + Optional passesFilter, Map additionalProperties) { this.id = id; this.statusCode = statusCode; this.payload = payload; this.createdAt = createdAt; this.updatedAt = updatedAt; + this.notificationUrl = notificationUrl; + this.passesFilter = passesFilter; this.additionalProperties = additionalProperties; } @@ -59,7 +67,7 @@ public Optional getId() { } /** - * @return The status code returned by the subscription notification URL. + * @return The HTTP status code returned by the notification URL. */ @JsonIgnore public Optional getStatusCode() { @@ -70,10 +78,10 @@ public Optional getStatusCode() { } /** - * @return An object containing the payload of the test event. For example, a payment.created event. + * @return The payload that was sent in the test notification. */ @JsonIgnore - public Optional getPayload() { + public Optional> getPayload() { if (payload == null) { return Optional.empty(); } @@ -98,6 +106,25 @@ public Optional getUpdatedAt() { return updatedAt; } + /** + * @return The URL that was used for the webhook notification test. + */ + @JsonProperty("notification_url") + public Optional getNotificationUrl() { + return notificationUrl; + } + + /** + * @return Whether the notification passed any configured filters. + */ + @JsonIgnore + public Optional getPassesFilter() { + if (passesFilter == null) { + return Optional.empty(); + } + return passesFilter; + } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("status_code") private Optional _getStatusCode() { @@ -106,10 +133,16 @@ private Optional _getStatusCode() { @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("payload") - private Optional _getPayload() { + private Optional> _getPayload() { return payload; } + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("passes_filter") + private Optional _getPassesFilter() { + return passesFilter; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -126,12 +159,21 @@ private boolean equalTo(SubscriptionTestResult other) { && statusCode.equals(other.statusCode) && payload.equals(other.payload) && createdAt.equals(other.createdAt) - && updatedAt.equals(other.updatedAt); + && updatedAt.equals(other.updatedAt) + && notificationUrl.equals(other.notificationUrl) + && passesFilter.equals(other.passesFilter); } @java.lang.Override public int hashCode() { - return Objects.hash(this.id, this.statusCode, this.payload, this.createdAt, this.updatedAt); + return Objects.hash( + this.id, + this.statusCode, + this.payload, + this.createdAt, + this.updatedAt, + this.notificationUrl, + this.passesFilter); } @java.lang.Override @@ -149,12 +191,16 @@ public static final class Builder { private Optional statusCode = Optional.empty(); - private Optional payload = Optional.empty(); + private Optional> payload = Optional.empty(); private Optional createdAt = Optional.empty(); private Optional updatedAt = Optional.empty(); + private Optional notificationUrl = Optional.empty(); + + private Optional passesFilter = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -166,6 +212,8 @@ public Builder from(SubscriptionTestResult other) { payload(other.getPayload()); createdAt(other.getCreatedAt()); updatedAt(other.getUpdatedAt()); + notificationUrl(other.getNotificationUrl()); + passesFilter(other.getPassesFilter()); return this; } @@ -184,7 +232,7 @@ public Builder id(String id) { } /** - *

The status code returned by the subscription notification URL.

+ *

The HTTP status code returned by the notification URL.

*/ @JsonSetter(value = "status_code", nulls = Nulls.SKIP) public Builder statusCode(Optional statusCode) { @@ -209,20 +257,20 @@ public Builder statusCode(Nullable statusCode) { } /** - *

An object containing the payload of the test event. For example, a payment.created event.

+ *

The payload that was sent in the test notification.

*/ @JsonSetter(value = "payload", nulls = Nulls.SKIP) - public Builder payload(Optional payload) { + public Builder payload(Optional> payload) { this.payload = payload; return this; } - public Builder payload(String payload) { + public Builder payload(Map payload) { this.payload = Optional.ofNullable(payload); return this; } - public Builder payload(Nullable payload) { + public Builder payload(Nullable> payload) { if (payload.isNull()) { this.payload = null; } else if (payload.isEmpty()) { @@ -263,8 +311,48 @@ public Builder updatedAt(String updatedAt) { return this; } + /** + *

The URL that was used for the webhook notification test.

+ */ + @JsonSetter(value = "notification_url", nulls = Nulls.SKIP) + public Builder notificationUrl(Optional notificationUrl) { + this.notificationUrl = notificationUrl; + return this; + } + + public Builder notificationUrl(String notificationUrl) { + this.notificationUrl = Optional.ofNullable(notificationUrl); + return this; + } + + /** + *

Whether the notification passed any configured filters.

+ */ + @JsonSetter(value = "passes_filter", nulls = Nulls.SKIP) + public Builder passesFilter(Optional passesFilter) { + this.passesFilter = passesFilter; + return this; + } + + public Builder passesFilter(Boolean passesFilter) { + this.passesFilter = Optional.ofNullable(passesFilter); + return this; + } + + public Builder passesFilter(Nullable passesFilter) { + if (passesFilter.isNull()) { + this.passesFilter = null; + } else if (passesFilter.isEmpty()) { + this.passesFilter = Optional.empty(); + } else { + this.passesFilter = Optional.of(passesFilter.get()); + } + return this; + } + public SubscriptionTestResult build() { - return new SubscriptionTestResult(id, statusCode, payload, createdAt, updatedAt, additionalProperties); + return new SubscriptionTestResult( + id, statusCode, payload, createdAt, updatedAt, notificationUrl, passesFilter, additionalProperties); } } } diff --git a/src/main/java/com/squareup/square/types/TestWebhookSubscriptionResponse.java b/src/main/java/com/squareup/square/types/TestWebhookSubscriptionResponse.java index 835e899b..a55d557a 100644 --- a/src/main/java/com/squareup/square/types/TestWebhookSubscriptionResponse.java +++ b/src/main/java/com/squareup/square/types/TestWebhookSubscriptionResponse.java @@ -5,12 +5,15 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.squareup.square.core.Nullable; +import com.squareup.square.core.NullableNonemptyFilter; import com.squareup.square.core.ObjectMappers; import java.util.HashMap; import java.util.List; @@ -25,14 +28,30 @@ public final class TestWebhookSubscriptionResponse { private final Optional subscriptionTestResult; + private final Optional notificationUrl; + + private final Optional statusCode; + + private final Optional passesFilter; + + private final Optional> payload; + private final Map additionalProperties; private TestWebhookSubscriptionResponse( Optional> errors, Optional subscriptionTestResult, + Optional notificationUrl, + Optional statusCode, + Optional passesFilter, + Optional> payload, Map additionalProperties) { this.errors = errors; this.subscriptionTestResult = subscriptionTestResult; + this.notificationUrl = notificationUrl; + this.statusCode = statusCode; + this.passesFilter = passesFilter; + this.payload = payload; this.additionalProperties = additionalProperties; } @@ -52,6 +71,65 @@ public Optional getSubscriptionTestResult() { return subscriptionTestResult; } + /** + * @return The URL that was used for the webhook notification test. + */ + @JsonProperty("notification_url") + public Optional getNotificationUrl() { + return notificationUrl; + } + + /** + * @return The HTTP status code returned by the notification URL. + */ + @JsonIgnore + public Optional getStatusCode() { + if (statusCode == null) { + return Optional.empty(); + } + return statusCode; + } + + /** + * @return Whether the notification passed any configured filters. + */ + @JsonIgnore + public Optional getPassesFilter() { + if (passesFilter == null) { + return Optional.empty(); + } + return passesFilter; + } + + /** + * @return The payload that was sent in the test notification. + */ + @JsonIgnore + public Optional> getPayload() { + if (payload == null) { + return Optional.empty(); + } + return payload; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("status_code") + private Optional _getStatusCode() { + return statusCode; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("passes_filter") + private Optional _getPassesFilter() { + return passesFilter; + } + + @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) + @JsonProperty("payload") + private Optional> _getPayload() { + return payload; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -64,12 +142,23 @@ public Map getAdditionalProperties() { } private boolean equalTo(TestWebhookSubscriptionResponse other) { - return errors.equals(other.errors) && subscriptionTestResult.equals(other.subscriptionTestResult); + return errors.equals(other.errors) + && subscriptionTestResult.equals(other.subscriptionTestResult) + && notificationUrl.equals(other.notificationUrl) + && statusCode.equals(other.statusCode) + && passesFilter.equals(other.passesFilter) + && payload.equals(other.payload); } @java.lang.Override public int hashCode() { - return Objects.hash(this.errors, this.subscriptionTestResult); + return Objects.hash( + this.errors, + this.subscriptionTestResult, + this.notificationUrl, + this.statusCode, + this.passesFilter, + this.payload); } @java.lang.Override @@ -87,6 +176,14 @@ public static final class Builder { private Optional subscriptionTestResult = Optional.empty(); + private Optional notificationUrl = Optional.empty(); + + private Optional statusCode = Optional.empty(); + + private Optional passesFilter = Optional.empty(); + + private Optional> payload = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -95,6 +192,10 @@ private Builder() {} public Builder from(TestWebhookSubscriptionResponse other) { errors(other.getErrors()); subscriptionTestResult(other.getSubscriptionTestResult()); + notificationUrl(other.getNotificationUrl()); + statusCode(other.getStatusCode()); + passesFilter(other.getPassesFilter()); + payload(other.getPayload()); return this; } @@ -126,8 +227,104 @@ public Builder subscriptionTestResult(SubscriptionTestResult subscriptionTestRes return this; } + /** + *

The URL that was used for the webhook notification test.

+ */ + @JsonSetter(value = "notification_url", nulls = Nulls.SKIP) + public Builder notificationUrl(Optional notificationUrl) { + this.notificationUrl = notificationUrl; + return this; + } + + public Builder notificationUrl(String notificationUrl) { + this.notificationUrl = Optional.ofNullable(notificationUrl); + return this; + } + + /** + *

The HTTP status code returned by the notification URL.

+ */ + @JsonSetter(value = "status_code", nulls = Nulls.SKIP) + public Builder statusCode(Optional statusCode) { + this.statusCode = statusCode; + return this; + } + + public Builder statusCode(Integer statusCode) { + this.statusCode = Optional.ofNullable(statusCode); + return this; + } + + public Builder statusCode(Nullable statusCode) { + if (statusCode.isNull()) { + this.statusCode = null; + } else if (statusCode.isEmpty()) { + this.statusCode = Optional.empty(); + } else { + this.statusCode = Optional.of(statusCode.get()); + } + return this; + } + + /** + *

Whether the notification passed any configured filters.

+ */ + @JsonSetter(value = "passes_filter", nulls = Nulls.SKIP) + public Builder passesFilter(Optional passesFilter) { + this.passesFilter = passesFilter; + return this; + } + + public Builder passesFilter(Boolean passesFilter) { + this.passesFilter = Optional.ofNullable(passesFilter); + return this; + } + + public Builder passesFilter(Nullable passesFilter) { + if (passesFilter.isNull()) { + this.passesFilter = null; + } else if (passesFilter.isEmpty()) { + this.passesFilter = Optional.empty(); + } else { + this.passesFilter = Optional.of(passesFilter.get()); + } + return this; + } + + /** + *

The payload that was sent in the test notification.

+ */ + @JsonSetter(value = "payload", nulls = Nulls.SKIP) + public Builder payload(Optional> payload) { + this.payload = payload; + return this; + } + + public Builder payload(Map payload) { + this.payload = Optional.ofNullable(payload); + return this; + } + + public Builder payload(Nullable> payload) { + if (payload.isNull()) { + this.payload = null; + } else if (payload.isEmpty()) { + this.payload = Optional.empty(); + } else { + this.payload = Optional.of(payload.get()); + } + return this; + } + public TestWebhookSubscriptionResponse build() { - return new TestWebhookSubscriptionResponse(errors, subscriptionTestResult, additionalProperties); + return new TestWebhookSubscriptionResponse( + errors, + subscriptionTestResult, + notificationUrl, + statusCode, + passesFilter, + payload, + additionalProperties); } } } diff --git a/src/main/java/com/squareup/square/webhooks/AsyncEventTypesClient.java b/src/main/java/com/squareup/square/webhooks/AsyncEventTypesClient.java index 9b9daa90..c82fce53 100644 --- a/src/main/java/com/squareup/square/webhooks/AsyncEventTypesClient.java +++ b/src/main/java/com/squareup/square/webhooks/AsyncEventTypesClient.java @@ -33,6 +33,13 @@ public CompletableFuture list() { return this.rawClient.list().thenApply(response -> response.body()); } + /** + * Lists all webhook event types that can be subscribed to. + */ + public CompletableFuture list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + /** * Lists all webhook event types that can be subscribed to. */ diff --git a/src/main/java/com/squareup/square/webhooks/AsyncRawEventTypesClient.java b/src/main/java/com/squareup/square/webhooks/AsyncRawEventTypesClient.java index 1d5df07c..43ea95ed 100644 --- a/src/main/java/com/squareup/square/webhooks/AsyncRawEventTypesClient.java +++ b/src/main/java/com/squareup/square/webhooks/AsyncRawEventTypesClient.java @@ -38,6 +38,14 @@ public CompletableFuture return list(ListEventTypesRequest.builder().build()); } + /** + * Lists all webhook event types that can be subscribed to. + */ + public CompletableFuture> list( + RequestOptions requestOptions) { + return list(ListEventTypesRequest.builder().build(), requestOptions); + } + /** * Lists all webhook event types that can be subscribed to. */ diff --git a/src/main/java/com/squareup/square/webhooks/AsyncRawSubscriptionsClient.java b/src/main/java/com/squareup/square/webhooks/AsyncRawSubscriptionsClient.java index 4199a25a..78e0038f 100644 --- a/src/main/java/com/squareup/square/webhooks/AsyncRawSubscriptionsClient.java +++ b/src/main/java/com/squareup/square/webhooks/AsyncRawSubscriptionsClient.java @@ -59,6 +59,14 @@ public CompletableFuture>> list( + RequestOptions requestOptions) { + return list(ListSubscriptionsRequest.builder().build(), requestOptions); + } + /** * Lists all webhook subscriptions owned by your application. */ diff --git a/src/main/java/com/squareup/square/webhooks/AsyncSubscriptionsClient.java b/src/main/java/com/squareup/square/webhooks/AsyncSubscriptionsClient.java index c41185da..495e3c36 100644 --- a/src/main/java/com/squareup/square/webhooks/AsyncSubscriptionsClient.java +++ b/src/main/java/com/squareup/square/webhooks/AsyncSubscriptionsClient.java @@ -46,6 +46,13 @@ public CompletableFuture> list() { return this.rawClient.list().thenApply(response -> response.body()); } + /** + * Lists all webhook subscriptions owned by your application. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + /** * Lists all webhook subscriptions owned by your application. */ diff --git a/src/main/java/com/squareup/square/webhooks/EventTypesClient.java b/src/main/java/com/squareup/square/webhooks/EventTypesClient.java index e73421c8..314dc36e 100644 --- a/src/main/java/com/squareup/square/webhooks/EventTypesClient.java +++ b/src/main/java/com/squareup/square/webhooks/EventTypesClient.java @@ -32,6 +32,13 @@ public ListWebhookEventTypesResponse list() { return this.rawClient.list().body(); } + /** + * Lists all webhook event types that can be subscribed to. + */ + public ListWebhookEventTypesResponse list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + /** * Lists all webhook event types that can be subscribed to. */ diff --git a/src/main/java/com/squareup/square/webhooks/RawEventTypesClient.java b/src/main/java/com/squareup/square/webhooks/RawEventTypesClient.java index 5b84df24..ba069e87 100644 --- a/src/main/java/com/squareup/square/webhooks/RawEventTypesClient.java +++ b/src/main/java/com/squareup/square/webhooks/RawEventTypesClient.java @@ -34,6 +34,13 @@ public SquareClientHttpResponse list() { return list(ListEventTypesRequest.builder().build()); } + /** + * Lists all webhook event types that can be subscribed to. + */ + public SquareClientHttpResponse list(RequestOptions requestOptions) { + return list(ListEventTypesRequest.builder().build(), requestOptions); + } + /** * Lists all webhook event types that can be subscribed to. */ diff --git a/src/main/java/com/squareup/square/webhooks/RawSubscriptionsClient.java b/src/main/java/com/squareup/square/webhooks/RawSubscriptionsClient.java index 110636eb..1a8279fd 100644 --- a/src/main/java/com/squareup/square/webhooks/RawSubscriptionsClient.java +++ b/src/main/java/com/squareup/square/webhooks/RawSubscriptionsClient.java @@ -54,6 +54,13 @@ public SquareClientHttpResponse> list() return list(ListSubscriptionsRequest.builder().build()); } + /** + * Lists all webhook subscriptions owned by your application. + */ + public SquareClientHttpResponse> list(RequestOptions requestOptions) { + return list(ListSubscriptionsRequest.builder().build(), requestOptions); + } + /** * Lists all webhook subscriptions owned by your application. */ diff --git a/src/main/java/com/squareup/square/webhooks/SubscriptionsClient.java b/src/main/java/com/squareup/square/webhooks/SubscriptionsClient.java index 757ba971..a7f9effe 100644 --- a/src/main/java/com/squareup/square/webhooks/SubscriptionsClient.java +++ b/src/main/java/com/squareup/square/webhooks/SubscriptionsClient.java @@ -45,6 +45,13 @@ public SyncPagingIterable list() { return this.rawClient.list().body(); } + /** + * Lists all webhook subscriptions owned by your application. + */ + public SyncPagingIterable list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + /** * Lists all webhook subscriptions owned by your application. */ diff --git a/src/test/java/com/squareup/square/StreamTest.java b/src/test/java/com/squareup/square/StreamTest.java index 0b5d9d30..d92bb955 100644 --- a/src/test/java/com/squareup/square/StreamTest.java +++ b/src/test/java/com/squareup/square/StreamTest.java @@ -9,6 +9,9 @@ import com.squareup.square.core.Stream; import java.io.IOException; import java.io.StringReader; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -17,8 +20,9 @@ public final class StreamTest { @Test public void testJsonStream() { - List messages = List.of(Map.of("message", "hello"), Map.of("message", "world")); - List jsonStrings = messages.stream().map(StreamTest::mapToJson).collect(Collectors.toList()); + List> messages = + Arrays.asList(createMap("message", "hello"), createMap("message", "world")); + List jsonStrings = messages.stream().map(StreamTest::mapToJson).collect(Collectors.toList()); String input = String.join("\n", jsonStrings); StringReader jsonInput = new StringReader(input); Stream jsonStream = Stream.fromJson(Map.class, jsonInput); @@ -33,8 +37,8 @@ public void testJsonStream() { @Test public void testSseStream() { - List events = List.of(Map.of("event", "start"), Map.of("event", "end")); - List sseStrings = events.stream().map(StreamTest::mapToSse).collect(Collectors.toList()); + List> events = Arrays.asList(createMap("event", "start"), createMap("event", "end")); + List sseStrings = events.stream().map(StreamTest::mapToSse).collect(Collectors.toList()); String input = String.join("\n" + "\n", sseStrings); StringReader sseInput = new StringReader(input); Stream sseStream = Stream.fromSse(Map.class, sseInput); @@ -49,8 +53,9 @@ public void testSseStream() { @Test public void testSseStreamWithTerminator() { - List events = List.of(Map.of("message", "first"), Map.of("message", "second")); - List sseStrings = events.stream().map(StreamTest::mapToSse).collect(Collectors.toList()); + List> events = Arrays.asList(createMap("message", "first"), createMap("message", "second")); + List sseStrings = + new ArrayList<>(events.stream().map(StreamTest::mapToSse).collect(Collectors.toList())); sseStrings.add("data: [DONE]"); String input = String.join("\n" + "\n", sseStrings); StringReader sseInput = new StringReader(input); @@ -83,4 +88,10 @@ private static String mapToJson(Map map) { private static String mapToSse(Map map) { return "data: " + mapToJson(map); } + + private static Map createMap(String key, String value) { + Map map = new HashMap<>(); + map.put(key, value); + return map; + } }