From d0f08d3594a380406bc3dbcaf6d7f077538a8616 Mon Sep 17 00:00:00 2001
From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com>
Date: Fri, 16 Jan 2026 03:05:53 +0000
Subject: [PATCH] SDK regeneration
Unable to analyze changes with AI, incrementing PATCH version.
---
.fern/metadata.json | 16 -
.fernignore | 1 +
LICENSE | 2 +-
README.md | 53 +-
build.gradle | 18 +-
changelog.md | 4 +
reference.md | 1430 +++--------------
.../squareup/square/AsyncChannelsClient.java | 63 -
.../square/AsyncRawApplePayClient.java | 11 +-
.../square/AsyncRawBankAccountsClient.java | 52 +-
.../square/AsyncRawBookingsClient.java | 119 +-
.../squareup/square/AsyncRawCardsClient.java | 42 +-
.../square/AsyncRawCatalogClient.java | 110 +-
.../square/AsyncRawChannelsClient.java | 244 ---
.../square/AsyncRawCheckoutClient.java | 40 +-
.../square/AsyncRawCustomersClient.java | 123 +-
.../square/AsyncRawDevicesClient.java | 39 +-
.../square/AsyncRawDisputesClient.java | 88 +-
.../square/AsyncRawEmployeesClient.java | 39 +-
.../squareup/square/AsyncRawEventsClient.java | 41 +-
.../square/AsyncRawGiftCardsClient.java | 90 +-
.../square/AsyncRawInventoryClient.java | 206 +--
.../square/AsyncRawInvoicesClient.java | 129 +-
.../squareup/square/AsyncRawLaborClient.java | 115 +-
.../square/AsyncRawLocationsClient.java | 53 +-
.../square/AsyncRawLoyaltyClient.java | 10 +-
.../square/AsyncRawMerchantsClient.java | 39 +-
.../squareup/square/AsyncRawMobileClient.java | 10 +-
.../squareup/square/AsyncRawOAuthClient.java | 36 +-
.../squareup/square/AsyncRawOrdersClient.java | 82 +-
.../square/AsyncRawPaymentsClient.java | 90 +-
.../square/AsyncRawPayoutsClient.java | 68 +-
.../square/AsyncRawRefundsClient.java | 50 +-
.../squareup/square/AsyncRawSitesClient.java | 10 +-
.../square/AsyncRawSnippetsClient.java | 30 +-
.../square/AsyncRawSubscriptionsClient.java | 140 +-
.../squareup/square/AsyncRawTeamClient.java | 40 +-
.../square/AsyncRawTeamMembersClient.java | 62 +-
.../square/AsyncRawTerminalClient.java | 30 +-
.../square/AsyncRawTransferOrdersClient.java | 734 ---------
.../square/AsyncRawV1TransactionsClient.java | 30 +-
.../square/AsyncRawVendorsClient.java | 71 +-
.../squareup/square/AsyncSquareClient.java | 14 -
.../square/AsyncSquareClientBuilder.java | 177 +-
.../square/AsyncTransferOrdersClient.java | 307 ----
.../com/squareup/square/ChannelsClient.java | 61 -
.../squareup/square/RawApplePayClient.java | 10 +-
.../square/RawBankAccountsClient.java | 33 +-
.../squareup/square/RawBookingsClient.java | 109 +-
.../com/squareup/square/RawCardsClient.java | 47 +-
.../com/squareup/square/RawCatalogClient.java | 96 +-
.../squareup/square/RawChannelsClient.java | 191 ---
.../squareup/square/RawCheckoutClient.java | 44 +-
.../squareup/square/RawCustomersClient.java | 107 +-
.../com/squareup/square/RawDevicesClient.java | 26 +-
.../squareup/square/RawDisputesClient.java | 75 +-
.../squareup/square/RawEmployeesClient.java | 27 +-
.../com/squareup/square/RawEventsClient.java | 43 +-
.../squareup/square/RawGiftCardsClient.java | 78 +-
.../squareup/square/RawInventoryClient.java | 150 +-
.../squareup/square/RawInvoicesClient.java | 120 +-
.../com/squareup/square/RawLaborClient.java | 111 +-
.../squareup/square/RawLocationsClient.java | 52 +-
.../com/squareup/square/RawLoyaltyClient.java | 10 +-
.../squareup/square/RawMerchantsClient.java | 27 +-
.../com/squareup/square/RawMobileClient.java | 10 +-
.../com/squareup/square/RawOAuthClient.java | 38 +-
.../com/squareup/square/RawOrdersClient.java | 83 +-
.../squareup/square/RawPaymentsClient.java | 79 +-
.../com/squareup/square/RawPayoutsClient.java | 39 +-
.../com/squareup/square/RawRefundsClient.java | 34 +-
.../com/squareup/square/RawSitesClient.java | 10 +-
.../squareup/square/RawSnippetsClient.java | 32 +-
.../square/RawSubscriptionsClient.java | 128 +-
.../com/squareup/square/RawTeamClient.java | 41 +-
.../squareup/square/RawTeamMembersClient.java | 63 +-
.../squareup/square/RawTerminalClient.java | 31 +-
.../square/RawTransferOrdersClient.java | 602 -------
.../square/RawV1TransactionsClient.java | 31 +-
.../com/squareup/square/RawVendorsClient.java | 73 +-
.../com/squareup/square/SquareClient.java | 14 -
.../squareup/square/SquareClientBuilder.java | 177 +-
.../squareup/square/TransferOrdersClient.java | 299 ----
...ncRawCustomAttributeDefinitionsClient.java | 52 +-
.../AsyncRawCustomAttributesClient.java | 79 +-
.../AsyncRawLocationProfilesClient.java | 12 +-
.../AsyncRawTeamMemberProfilesClient.java | 22 +-
.../RawCustomAttributeDefinitionsClient.java | 53 +-
.../bookings/RawCustomAttributesClient.java | 63 +-
.../bookings/RawLocationProfilesClient.java | 13 +-
.../bookings/RawTeamMemberProfilesClient.java | 23 +-
...kDeleteBookingCustomAttributesRequest.java | 8 +-
...kUpsertBookingCustomAttributesRequest.java | 8 +-
.../cashdrawers/AsyncRawShiftsClient.java | 51 +-
.../square/cashdrawers/RawShiftsClient.java | 36 +-
.../square/catalog/AsyncImagesClient.java | 23 -
.../square/catalog/AsyncRawImagesClient.java | 226 +--
.../square/catalog/AsyncRawObjectClient.java | 31 +-
.../squareup/square/catalog/ImagesClient.java | 21 -
.../square/catalog/RawImagesClient.java | 169 +-
.../square/catalog/RawObjectClient.java | 30 +-
.../checkout/AsyncRawPaymentLinksClient.java | 72 +-
.../checkout/RawPaymentLinksClient.java | 53 +-
.../square/core/AsyncCustomPager.java | 164 --
.../com/squareup/square/core/BasePage.java | 16 +-
.../square/core/BiDirectionalPage.java | 60 -
.../squareup/square/core/ClientOptions.java | 30 +-
.../com/squareup/square/core/CustomPager.java | 117 --
.../square/core/NullableNonemptyFilter.java | 5 +-
.../squareup/square/core/ObjectMappers.java | 9 -
.../squareup/square/core/RequestOptions.java | 2 +-
.../square/core/RetryInterceptor.java | 118 +-
.../java/com/squareup/square/core/Stream.java | 82 +-
.../com/squareup/square/core/SyncPage.java | 4 +-
.../square/core/SyncPagingIterable.java | 10 +-
.../square/customers/AsyncRawCardsClient.java | 20 +-
...ncRawCustomAttributeDefinitionsClient.java | 62 +-
.../AsyncRawCustomAttributesClient.java | 59 +-
.../customers/AsyncRawGroupsClient.java | 90 +-
.../customers/AsyncRawSegmentsClient.java | 39 +-
.../square/customers/RawCardsClient.java | 20 +-
.../RawCustomAttributeDefinitionsClient.java | 63 +-
.../customers/RawCustomAttributesClient.java | 43 +-
.../square/customers/RawGroupsClient.java | 74 +-
.../square/customers/RawSegmentsClient.java | 23 +-
...UpsertCustomerCustomAttributesRequest.java | 8 +-
.../square/devices/AsyncRawCodesClient.java | 52 +-
.../square/devices/RawCodesClient.java | 34 +-
.../disputes/AsyncRawEvidenceClient.java | 49 +-
.../square/disputes/RawEvidenceClient.java | 33 +-
.../giftcards/AsyncRawActivitiesClient.java | 39 +-
.../square/giftcards/RawActivitiesClient.java | 26 +-
.../labor/AsyncRawBreakTypesClient.java | 74 +-
.../labor/AsyncRawEmployeeWagesClient.java | 40 +-
.../square/labor/AsyncRawShiftsClient.java | 50 +-
.../labor/AsyncRawTeamMemberWagesClient.java | 39 +-
.../labor/AsyncRawWorkweekConfigsClient.java | 39 +-
.../square/labor/RawBreakTypesClient.java | 57 +-
.../square/labor/RawEmployeeWagesClient.java | 23 +-
.../square/labor/RawShiftsClient.java | 54 +-
.../labor/RawTeamMemberWagesClient.java | 23 +-
.../labor/RawWorkweekConfigsClient.java | 23 +-
...ncRawCustomAttributeDefinitionsClient.java | 52 +-
.../AsyncRawCustomAttributesClient.java | 79 +-
.../locations/AsyncRawTransactionsClient.java | 43 +-
.../RawCustomAttributeDefinitionsClient.java | 53 +-
.../locations/RawCustomAttributesClient.java | 63 +-
.../locations/RawTransactionsClient.java | 40 +-
...DeleteLocationCustomAttributesRequest.java | 8 +-
...UpsertLocationCustomAttributesRequest.java | 8 +-
.../loyalty/AsyncRawAccountsClient.java | 50 +-
.../loyalty/AsyncRawProgramsClient.java | 30 +-
.../square/loyalty/AsyncRawRewardsClient.java | 51 +-
.../square/loyalty/RawAccountsClient.java | 51 +-
.../square/loyalty/RawProgramsClient.java | 31 +-
.../square/loyalty/RawRewardsClient.java | 50 +-
.../programs/AsyncRawPromotionsClient.java | 59 +-
.../loyalty/programs/RawPromotionsClient.java | 45 +-
...ncRawCustomAttributeDefinitionsClient.java | 52 +-
.../AsyncRawCustomAttributesClient.java | 79 +-
.../RawCustomAttributeDefinitionsClient.java | 53 +-
.../merchants/RawCustomAttributesClient.java | 63 +-
...DeleteMerchantCustomAttributesRequest.java | 8 +-
...UpsertMerchantCustomAttributesRequest.java | 8 +-
...ncRawCustomAttributeDefinitionsClient.java | 52 +-
.../AsyncRawCustomAttributesClient.java | 79 +-
.../RawCustomAttributeDefinitionsClient.java | 53 +-
.../orders/RawCustomAttributesClient.java | 63 +-
...ulkDeleteOrderCustomAttributesRequest.java | 8 +-
...ulkUpsertOrderCustomAttributesRequest.java | 8 +-
.../AsyncRawWageSettingClient.java | 21 +-
.../teammembers/RawWageSettingClient.java | 20 +-
.../terminal/AsyncRawActionsClient.java | 40 +-
.../terminal/AsyncRawCheckoutsClient.java | 40 +-
.../terminal/AsyncRawRefundsClient.java | 40 +-
.../square/terminal/RawActionsClient.java | 40 +-
.../square/terminal/RawCheckoutsClient.java | 43 +-
.../square/terminal/RawRefundsClient.java | 40 +-
.../types/BatchCreateTeamMembersRequest.java | 8 +-
.../types/BatchCreateVendorsRequest.java | 8 +-
.../BatchDeleteCatalogObjectsRequest.java | 8 +-
.../types/BatchGetCatalogObjectsRequest.java | 8 +-
.../square/types/BatchGetOrdersRequest.java | 8 +-
.../types/BatchUpdateTeamMembersRequest.java | 8 +-
.../types/BatchUpdateVendorsRequest.java | 8 +-
.../BatchUpsertCatalogObjectsRequest.java | 8 +-
.../types/BulkCreateCustomersRequest.java | 8 +-
.../types/BulkDeleteCustomersRequest.java | 8 +-
...eleteLocationCustomAttributesResponse.java | 8 +-
...eleteMerchantCustomAttributesResponse.java | 8 +-
...lkDeleteOrderCustomAttributesResponse.java | 8 +-
.../BulkPublishScheduledShiftsRequest.java | 8 +-
.../types/BulkRetrieveBookingsRequest.java | 8 +-
.../types/BulkRetrieveChannelsRequest.java | 106 --
.../types/BulkRetrieveChannelsResponse.java | 139 --
.../types/BulkRetrieveCustomersRequest.java | 8 +-
...rieveTeamMemberBookingProfilesRequest.java | 8 +-
.../types/BulkUpdateCustomersRequest.java | 8 +-
...lkUpsertOrderCustomAttributesResponse.java | 8 +-
.../types/CancelTransferOrderRequest.java | 199 ---
.../types/CancelTransferOrderResponse.java | 133 --
.../square/types/CardPaymentDetails.java | 289 +++-
.../CatalogCustomAttributeDefinition.java | 8 +-
.../square/types/CatalogObjectBatch.java | 8 +-
.../CatalogQueryItemsForModifierList.java | 8 +-
.../square/types/CatalogQueryItemsForTax.java | 8 +-
.../square/types/CatalogQuerySet.java | 8 +-
.../square/types/CatalogQueryText.java | 8 +-
.../CatalogSubscriptionPlanVariation.java | 8 +-
.../com/squareup/square/types/Channel.java | 351 ----
.../squareup/square/types/ChannelStatus.java | 83 -
.../types/CreateSubscriptionRequest.java | 8 +-
.../square/types/CreateTransferOrderData.java | 535 ------
.../types/CreateTransferOrderLineData.java | 171 --
.../types/CreateTransferOrderRequest.java | 151 --
.../types/CreateTransferOrderResponse.java | 133 --
.../types/DeleteTransferOrderResponse.java | 102 --
.../types/DeleteTransferOrdersRequest.java | 187 ---
.../square/types/DeviceAttributes.java | 12 +-
.../types/DeviceAttributesDeviceType.java | 86 -
...DeviceComponentDetailsEthernetDetails.java | 61 +-
.../DeviceComponentDetailsMeasurement.java | 6 -
.../DeviceComponentDetailsWiFiDetails.java | 57 +-
.../squareup/square/types/DeviceStatus.java | 6 +-
.../square/types/GetChannelsRequest.java | 113 --
.../types/GetTransferOrdersRequest.java | 113 --
.../squareup/square/types/InvoiceFilter.java | 8 +-
.../square/types/ListChannelsRequest.java | 328 ----
.../square/types/ListChannelsResponse.java | 162 --
...derCustomAttributeDefinitionsResponse.java | 8 +-
.../squareup/square/types/LoyaltyAccount.java | 35 +-
.../types/LoyaltyEventLocationFilter.java | 8 +-
.../square/types/LoyaltyEventTypeFilter.java | 8 +-
.../LoyaltyPromotionAvailableTimeData.java | 8 +-
.../com/squareup/square/types/Payment.java | 6 +-
.../types/ReceiveTransferOrderRequest.java | 231 ---
.../types/ReceiveTransferOrderResponse.java | 133 --
.../com/squareup/square/types/Reference.java | 131 --
.../squareup/square/types/ReferenceType.java | 218 ---
.../square/types/RetrieveChannelResponse.java | 131 --
.../types/RetrieveTransferOrderResponse.java | 133 --
.../square/types/SearchOrdersStateFilter.java | 8 +-
.../types/SearchTransferOrdersRequest.java | 161 --
.../types/SearchTransferOrdersResponse.java | 164 --
.../squareup/square/types/SelectOptions.java | 8 +-
.../types/StartTransferOrderRequest.java | 199 ---
.../types/StartTransferOrderResponse.java | 133 --
.../squareup/square/types/Subscription.java | 56 +-
.../square/types/SubscriptionActionType.java | 10 -
.../square/types/SubscriptionStatus.java | 10 -
.../squareup/square/types/TransferOrder.java | 714 --------
.../types/TransferOrderCreatedEvent.java | 286 ----
.../types/TransferOrderCreatedEventData.java | 184 ---
.../TransferOrderCreatedEventObject.java | 102 --
.../types/TransferOrderDeletedEvent.java | 286 ----
.../types/TransferOrderDeletedEventData.java | 204 ---
.../square/types/TransferOrderFilter.java | 229 ---
.../types/TransferOrderGoodsReceipt.java | 152 --
.../TransferOrderGoodsReceiptLineItem.java | 343 ----
.../square/types/TransferOrderLine.java | 410 -----
.../square/types/TransferOrderQuery.java | 132 --
.../square/types/TransferOrderSort.java | 136 --
.../square/types/TransferOrderSortField.java | 84 -
.../square/types/TransferOrderStatus.java | 114 --
.../types/TransferOrderUpdatedEvent.java | 286 ----
.../types/TransferOrderUpdatedEventData.java | 184 ---
.../TransferOrderUpdatedEventObject.java | 102 --
.../types/UpdateItemModifierListsRequest.java | 8 +-
.../square/types/UpdateItemTaxesRequest.java | 8 +-
.../square/types/UpdateTransferOrderData.java | 394 -----
.../types/UpdateTransferOrderLineData.java | 278 ----
.../types/UpdateTransferOrderRequest.java | 232 ---
.../types/UpdateTransferOrderResponse.java | 133 --
.../webhooks/AsyncRawEventTypesClient.java | 10 +-
.../webhooks/AsyncRawSubscriptionsClient.java | 89 +-
.../square/webhooks/RawEventTypesClient.java | 10 +-
.../webhooks/RawSubscriptionsClient.java | 77 +-
277 files changed, 5083 insertions(+), 18350 deletions(-)
delete mode 100644 .fern/metadata.json
create mode 100644 changelog.md
delete mode 100644 src/main/java/com/squareup/square/AsyncChannelsClient.java
delete mode 100644 src/main/java/com/squareup/square/AsyncRawChannelsClient.java
delete mode 100644 src/main/java/com/squareup/square/AsyncRawTransferOrdersClient.java
delete mode 100644 src/main/java/com/squareup/square/AsyncTransferOrdersClient.java
delete mode 100644 src/main/java/com/squareup/square/ChannelsClient.java
delete mode 100644 src/main/java/com/squareup/square/RawChannelsClient.java
delete mode 100644 src/main/java/com/squareup/square/RawTransferOrdersClient.java
delete mode 100644 src/main/java/com/squareup/square/TransferOrdersClient.java
delete mode 100644 src/main/java/com/squareup/square/core/AsyncCustomPager.java
delete mode 100644 src/main/java/com/squareup/square/core/BiDirectionalPage.java
delete mode 100644 src/main/java/com/squareup/square/core/CustomPager.java
delete mode 100644 src/main/java/com/squareup/square/types/BulkRetrieveChannelsRequest.java
delete mode 100644 src/main/java/com/squareup/square/types/BulkRetrieveChannelsResponse.java
delete mode 100644 src/main/java/com/squareup/square/types/CancelTransferOrderRequest.java
delete mode 100644 src/main/java/com/squareup/square/types/CancelTransferOrderResponse.java
delete mode 100644 src/main/java/com/squareup/square/types/Channel.java
delete mode 100644 src/main/java/com/squareup/square/types/ChannelStatus.java
delete mode 100644 src/main/java/com/squareup/square/types/CreateTransferOrderData.java
delete mode 100644 src/main/java/com/squareup/square/types/CreateTransferOrderLineData.java
delete mode 100644 src/main/java/com/squareup/square/types/CreateTransferOrderRequest.java
delete mode 100644 src/main/java/com/squareup/square/types/CreateTransferOrderResponse.java
delete mode 100644 src/main/java/com/squareup/square/types/DeleteTransferOrderResponse.java
delete mode 100644 src/main/java/com/squareup/square/types/DeleteTransferOrdersRequest.java
delete mode 100644 src/main/java/com/squareup/square/types/DeviceAttributesDeviceType.java
delete mode 100644 src/main/java/com/squareup/square/types/GetChannelsRequest.java
delete mode 100644 src/main/java/com/squareup/square/types/GetTransferOrdersRequest.java
delete mode 100644 src/main/java/com/squareup/square/types/ListChannelsRequest.java
delete mode 100644 src/main/java/com/squareup/square/types/ListChannelsResponse.java
delete mode 100644 src/main/java/com/squareup/square/types/ReceiveTransferOrderRequest.java
delete mode 100644 src/main/java/com/squareup/square/types/ReceiveTransferOrderResponse.java
delete mode 100644 src/main/java/com/squareup/square/types/Reference.java
delete mode 100644 src/main/java/com/squareup/square/types/ReferenceType.java
delete mode 100644 src/main/java/com/squareup/square/types/RetrieveChannelResponse.java
delete mode 100644 src/main/java/com/squareup/square/types/RetrieveTransferOrderResponse.java
delete mode 100644 src/main/java/com/squareup/square/types/SearchTransferOrdersRequest.java
delete mode 100644 src/main/java/com/squareup/square/types/SearchTransferOrdersResponse.java
delete mode 100644 src/main/java/com/squareup/square/types/StartTransferOrderRequest.java
delete mode 100644 src/main/java/com/squareup/square/types/StartTransferOrderResponse.java
delete mode 100644 src/main/java/com/squareup/square/types/TransferOrder.java
delete mode 100644 src/main/java/com/squareup/square/types/TransferOrderCreatedEvent.java
delete mode 100644 src/main/java/com/squareup/square/types/TransferOrderCreatedEventData.java
delete mode 100644 src/main/java/com/squareup/square/types/TransferOrderCreatedEventObject.java
delete mode 100644 src/main/java/com/squareup/square/types/TransferOrderDeletedEvent.java
delete mode 100644 src/main/java/com/squareup/square/types/TransferOrderDeletedEventData.java
delete mode 100644 src/main/java/com/squareup/square/types/TransferOrderFilter.java
delete mode 100644 src/main/java/com/squareup/square/types/TransferOrderGoodsReceipt.java
delete mode 100644 src/main/java/com/squareup/square/types/TransferOrderGoodsReceiptLineItem.java
delete mode 100644 src/main/java/com/squareup/square/types/TransferOrderLine.java
delete mode 100644 src/main/java/com/squareup/square/types/TransferOrderQuery.java
delete mode 100644 src/main/java/com/squareup/square/types/TransferOrderSort.java
delete mode 100644 src/main/java/com/squareup/square/types/TransferOrderSortField.java
delete mode 100644 src/main/java/com/squareup/square/types/TransferOrderStatus.java
delete mode 100644 src/main/java/com/squareup/square/types/TransferOrderUpdatedEvent.java
delete mode 100644 src/main/java/com/squareup/square/types/TransferOrderUpdatedEventData.java
delete mode 100644 src/main/java/com/squareup/square/types/TransferOrderUpdatedEventObject.java
delete mode 100644 src/main/java/com/squareup/square/types/UpdateTransferOrderData.java
delete mode 100644 src/main/java/com/squareup/square/types/UpdateTransferOrderLineData.java
delete mode 100644 src/main/java/com/squareup/square/types/UpdateTransferOrderRequest.java
delete mode 100644 src/main/java/com/squareup/square/types/UpdateTransferOrderResponse.java
diff --git a/.fern/metadata.json b/.fern/metadata.json
deleted file mode 100644
index 22890ea6..00000000
--- a/.fern/metadata.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "cliVersion": "2.8.1",
- "generatorName": "fernapi/fern-java-sdk",
- "generatorVersion": "3.19.0",
- "generatorConfig": {
- "base-api-exception-class-name": "SquareApiException",
- "base-exception-class-name": "SquareException",
- "client-class-name": "SquareClient",
- "inline-path-parameters": true,
- "inline-file-properties": true,
- "package-prefix": "com.squareup.square",
- "package-layout": "flat",
- "enable-forward-compatible-enums": true,
- "publish-to": "central"
- }
-}
\ No newline at end of file
diff --git a/.fernignore b/.fernignore
index 0dce8ae6..71d25ccb 100644
--- a/.fernignore
+++ b/.fernignore
@@ -6,3 +6,4 @@ src/main/java/com/squareup/square/core/SquareApiException.java
src/main/java/com/squareup/square/utilities/WebhooksHelper.java
src/test/resources/testdata
.github/workflows/ci.yml
+changelog.md
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..94db2591 100644
--- a/README.md
+++ b/README.md
@@ -26,8 +26,6 @@ The Square Java library provides convenient access to the Square APIs from Java.
- [Custom Client](#custom-client)
- [Retries](#retries)
- [Timeouts](#timeouts)
- - [Custom Headers](#custom-headers)
- - [Access Raw Response Data](#access-raw-response-data)
- [Contributing](#contributing)
## Requirements
@@ -56,7 +54,7 @@ Add the dependency in your `pom.xml` file:
com.squareup
square
- 45.2.0.20251016
+ 45.2.1
```
@@ -303,9 +301,9 @@ When the API returns a non-success status code (4xx or 5xx response), an API exc
```java
import com.squareup.square.core.SquareApiException;
-try{
+try {
client.payments().create(...);
-} catch (SquareApiException e){
+} catch (SquareApiException e) {
// Do something with the API exception...
}
```
@@ -389,7 +387,7 @@ Maven:
### Custom Client
-This SDK is built to work with any instance of `OkHttpClient`. By default, if no client is provided, the SDK will construct one.
+This SDK is built to work with any instance of `OkHttpClient`. By default, if no client is provided, the SDK will construct one.
However, you can pass your own client like so:
```java
@@ -408,9 +406,7 @@ SquareClient client = SquareClient
The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
-retry limit (default: 2). Before defaulting to exponential backoff, the SDK will first attempt to respect
-the `Retry-After` header (as either in seconds or as an HTTP date), and then the `X-RateLimit-Reset` header
-(as a Unix timestamp in epoch seconds); failing both of those, it will fall back to exponential backoff.
+retry limit (default: 2).
A request is deemed retryable when any of the following HTTP status codes is returned:
@@ -453,45 +449,6 @@ client.payments().create(
);
```
-### Custom Headers
-
-The SDK allows you to add custom headers to requests. You can configure headers at the client level or at the request level.
-
-```java
-import com.squareup.square.SquareClient;
-import com.squareup.square.core.RequestOptions;
-
-// Client level
-SquareClient client = SquareClient
- .builder()
- .addHeader("X-Custom-Header", "custom-value")
- .addHeader("X-Request-Id", "abc-123")
- .build();
-;
-
-// Request level
-client.payments().create(
- ...,
- RequestOptions
- .builder()
- .addHeader("X-Request-Header", "request-value")
- .build()
-);
-```
-
-### Access Raw Response Data
-
-The SDK provides access to raw response data, including headers, through the `withRawResponse()` method.
-The `withRawResponse()` method returns a raw client that wraps all responses with `body()` and `headers()` methods.
-(A normal client's `response` is identical to a raw client's `response.body()`.)
-
-```java
-CreateHttpResponse response = client.payments().withRawResponse().create(...);
-
-System.out.println(response.body());
-System.out.println(response.headers().get("X-My-Header"));
-```
-
## Contributing
While we value open-source contributions to this SDK, this library is generated programmatically.
diff --git a/build.gradle b/build.gradle
index f9a4f2c0..31fe999b 100644
--- a/build.gradle
+++ b/build.gradle
@@ -14,13 +14,12 @@ repositories {
}
dependencies {
- api 'com.squareup.okhttp3:okhttp:5.2.1'
- api 'com.fasterxml.jackson.core:jackson-databind:2.18.2'
- api 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.18.2'
- api 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.2'
+ api 'com.squareup.okhttp3:okhttp:4.12.0'
+ api 'com.fasterxml.jackson.core:jackson-databind:2.17.2'
+ api 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.17.2'
+ api 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
- testImplementation 'org.junit.jupiter:junit-jupiter-params:5.8.2'
}
@@ -47,7 +46,7 @@ java {
group = 'com.squareup'
-version = '45.2.0.20251016'
+version = '45.2.1'
jar {
dependsOn(":generatePomFileForMavenPublication")
@@ -78,7 +77,7 @@ publishing {
maven(MavenPublication) {
groupId = 'com.squareup'
artifactId = 'square'
- version = '45.2.0.20251016'
+ version = '45.2.1'
from components.java
pom {
name = 'square'
@@ -121,10 +120,9 @@ sonatypeCentralUpload {
}
signing {
- def signingKeyId = "$System.env.MAVEN_SIGNATURE_KID"
- def signingKey = "$System.env.MAVEN_SIGNATURE_SECRET_KEY"
+ def signingKeyId = "$System.env.MAVEN_SIGNATURE_SECRET_KEY"
def signingPassword = "$System.env.MAVEN_SIGNATURE_PASSWORD"
- useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
+ useInMemoryPgpKeys(signingKeyId, signingPassword)
sign publishing.publications.maven
}
diff --git a/changelog.md b/changelog.md
new file mode 100644
index 00000000..ca5cd1ed
--- /dev/null
+++ b/changelog.md
@@ -0,0 +1,4 @@
+## 45.2.1 - 2026-01-16
+* SDK regeneration
+* Unable to analyze changes with AI, incrementing PATCH version.
+
diff --git a/reference.md b/reference.md
index cad48580..1105700b 100644
--- a/reference.md
+++ b/reference.md
@@ -474,7 +474,7 @@ client.oAuth().authorize();
## V1Transactions
-client.v1Transactions.v1ListOrders(locationId) -> List<V1Order>
+client.v1Transactions.v1ListOrders(locationId) -> List<V1Order>
-
@@ -817,7 +817,7 @@ client.applePay().registerDomain(
## BankAccounts
-client.bankAccounts.list() -> SyncPagingIterable<BankAccount>
+client.bankAccounts.list() -> ListBankAccountsResponse
-
@@ -1030,7 +1030,7 @@ client.bankAccounts().get(
## Bookings
-client.bookings.list() -> SyncPagingIterable<Booking>
+client.bookings.list() -> ListBookingsResponse
-
@@ -1340,7 +1340,9 @@ client.bookings().bulkRetrieveBookings(
BulkRetrieveBookingsRequest
.builder()
.bookingIds(
- Arrays.asList("booking_ids")
+ new ArrayList(
+ Arrays.asList("booking_ids")
+ )
)
.build()
);
@@ -1499,7 +1501,9 @@ client.bookings().bulkRetrieveTeamMemberBookingProfiles(
BulkRetrieveTeamMemberBookingProfilesRequest
.builder()
.teamMemberIds(
- Arrays.asList("team_member_ids")
+ new ArrayList(
+ Arrays.asList("team_member_ids")
+ )
)
.build()
);
@@ -1759,7 +1763,7 @@ client.bookings().cancel(
## Cards
-client.cards.list() -> SyncPagingIterable<Card>
+client.cards.list() -> ListCardsResponse
-
@@ -2149,7 +2153,9 @@ client.catalog().batchDelete(
BatchDeleteCatalogObjectsRequest
.builder()
.objectIds(
- Arrays.asList("W62UWFY35CWMYGVWK6TWJDNI", "AA27W3M2GGTF3H6AVPNB77CK")
+ new ArrayList(
+ Arrays.asList("W62UWFY35CWMYGVWK6TWJDNI", "AA27W3M2GGTF3H6AVPNB77CK")
+ )
)
.build()
);
@@ -2219,7 +2225,9 @@ client.catalog().batchGet(
BatchGetCatalogObjectsRequest
.builder()
.objectIds(
- Arrays.asList("W62UWFY35CWMYGVWK6TWJDNI", "AA27W3M2GGTF3H6AVPNB77CK")
+ new ArrayList(
+ Arrays.asList("W62UWFY35CWMYGVWK6TWJDNI", "AA27W3M2GGTF3H6AVPNB77CK")
+ )
)
.includeRelatedObjects(true)
.build()
@@ -2269,7 +2277,7 @@ Default value: `false`
-
-**catalogVersion:** `Optional`
+**catalogVersion:** `Optional`
The specific version of the catalog objects to be included in the response.
This allows you to retrieve historical versions of objects. The specified version value is matched against
@@ -2351,38 +2359,42 @@ client.catalog().batchUpsert(
.builder()
.idempotencyKey("789ff020-f723-43a9-b4b5-43b5dc1fa3dc")
.batches(
- Arrays.asList(
- CatalogObjectBatch
- .builder()
- .objects(
- Arrays.asList(
- CatalogObject.item(
- CatalogObjectItem
- .builder()
- .id("id")
- .build()
- ),
- CatalogObject.item(
- CatalogObjectItem
- .builder()
- .id("id")
- .build()
- ),
- CatalogObject.item(
- CatalogObjectItem
- .builder()
- .id("id")
- .build()
- ),
- CatalogObject.tax(
- CatalogObjectTax
- .builder()
- .id("id")
- .build()
+ new ArrayList(
+ Arrays.asList(
+ CatalogObjectBatch
+ .builder()
+ .objects(
+ new ArrayList(
+ Arrays.asList(
+ CatalogObject.item(
+ CatalogObjectItem
+ .builder()
+ .id("id")
+ .build()
+ ),
+ CatalogObject.item(
+ CatalogObjectItem
+ .builder()
+ .id("id")
+ .build()
+ ),
+ CatalogObject.item(
+ CatalogObjectItem
+ .builder()
+ .id("id")
+ .build()
+ ),
+ CatalogObject.tax(
+ CatalogObjectTax
+ .builder()
+ .id("id")
+ .build()
+ )
+ )
)
)
- )
- .build()
+ .build()
+ )
)
)
.build()
@@ -2493,7 +2505,7 @@ client.catalog().info();
-client.catalog.list() -> SyncPagingIterable<CatalogObject>
+client.catalog.list() -> ListCatalogResponse
-
@@ -2584,7 +2596,7 @@ SUBSCRIPTION_PLAN, ITEM_OPTION, CUSTOM_ATTRIBUTE_DEFINITION, QUICK_AMOUNT_SETTIN
-
-**catalogVersion:** `Optional`
+**catalogVersion:** `Optional`
The specific version of the catalog objects to be included in the response.
This allows you to retrieve historical versions of objects. The specified version value is matched against
@@ -2641,7 +2653,7 @@ client.catalog().search(
SearchCatalogObjectsRequest
.builder()
.objectTypes(
- Optional.of(
+ new ArrayList(
Arrays.asList(CatalogObjectType.ITEM)
)
)
@@ -2824,29 +2836,29 @@ client.catalog().searchItems(
.builder()
.textFilter("red")
.categoryIds(
- Optional.of(
+ new ArrayList(
Arrays.asList("WINE_CATEGORY_ID")
)
)
.stockLevels(
- Optional.of(
+ new ArrayList(
Arrays.asList(SearchCatalogItemsRequestStockLevel.OUT, SearchCatalogItemsRequestStockLevel.LOW)
)
)
.enabledLocationIds(
- Optional.of(
+ new ArrayList(
Arrays.asList("ATL_LOCATION_ID")
)
)
.limit(100)
.sortOrder(SortOrder.ASC)
.productTypes(
- Optional.of(
+ new ArrayList(
Arrays.asList(CatalogItemProductType.REGULAR)
)
)
.customAttributeFilters(
- Optional.of(
+ new ArrayList(
Arrays.asList(
CustomAttributeFilter
.builder()
@@ -3023,15 +3035,17 @@ client.catalog().updateItemModifierLists(
UpdateItemModifierListsRequest
.builder()
.itemIds(
- Arrays.asList("H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6")
+ new ArrayList(
+ Arrays.asList("H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6")
+ )
)
.modifierListsToEnable(
- Optional.of(
+ new ArrayList(
Arrays.asList("H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6")
)
)
.modifierListsToDisable(
- Optional.of(
+ new ArrayList(
Arrays.asList("7WRC16CJZDVLSNDQ35PP6YAD")
)
)
@@ -3118,15 +3132,17 @@ client.catalog().updateItemTaxes(
UpdateItemTaxesRequest
.builder()
.itemIds(
- Arrays.asList("H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6")
+ new ArrayList(
+ Arrays.asList("H42BRLUJ5KTZTTMPVSLFAACQ", "2JXOBJIHCWBQ4NZ3RIXQGJA6")
+ )
)
.taxesToEnable(
- Optional.of(
+ new ArrayList(
Arrays.asList("4WRCNHCJZDVLSNDQ35PP6YAD")
)
)
.taxesToDisable(
- Optional.of(
+ new ArrayList(
Arrays.asList("AQCEGCEBBQONINDOHRGZISEX")
)
)
@@ -3179,231 +3195,12 @@ At least one of `taxes_to_enable` or `taxes_to_disable` must be specified.
-
-
-
-
-## Channels
-client.channels.list() -> SyncPagingIterable<Channel>
-
--
-
-#### 📝 Description
-
-
--
-
-
--
-
-
-
-
-
-
-
-#### 🔌 Usage
-
-
--
-
-
--
-
-```java
-client.channels().list(
- ListChannelsRequest
- .builder()
- .referenceType(ReferenceType.UNKNOWN_TYPE)
- .referenceId("reference_id")
- .status(ChannelStatus.ACTIVE)
- .cursor("cursor")
- .limit(1)
- .build()
-);
-```
-
-
-
-
-
-#### ⚙️ Parameters
-
-
--
-
-
--
-
-**referenceType:** `Optional` — Type of reference associated to channel
-
-
-
-
-
--
-
-**referenceId:** `Optional` — id of reference associated to channel
-
-
-
-
-
--
-
-**status:** `Optional` — Status of channel
-
-
-
-
-
--
-
-**cursor:** `Optional` — Cursor to fetch the next result
-
-
-
-
-
--
-
-**limit:** `Optional`
-
-Maximum number of results to return.
-When not provided the returned results will be cap at 100 channels.
-
-
-
-
-
-
-
-
-
-
-
-client.channels.bulkRetrieve(request) -> BulkRetrieveChannelsResponse
-
--
-
-#### 📝 Description
-
-
--
-
-
--
-
-
-
-
-
-
-
-#### 🔌 Usage
-
-
--
-
-
--
-
-```java
-client.channels().bulkRetrieve(
- BulkRetrieveChannelsRequest
- .builder()
- .channelIds(
- Arrays.asList("CH_9C03D0B59", "CH_6X139B5MN", "NOT_EXISTING")
- )
- .build()
-);
-```
-
-
-
-
-
-#### ⚙️ Parameters
-
-
--
-
-
--
-
-**channelIds:** `List`
-
-
-
-
-
-
-
-
-
-
-
-client.channels.get(channelId) -> RetrieveChannelResponse
-
--
-
-#### 📝 Description
-
-
--
-
-
--
-
-
-
-
-
-
-
-#### 🔌 Usage
-
-
--
-
-
--
-
-```java
-client.channels().get(
- GetChannelsRequest
- .builder()
- .channelId("channel_id")
- .build()
-);
-```
-
-
-
-
-
-#### ⚙️ Parameters
-
-
--
-
-
--
-
-**channelId:** `String` — A channel id
-
-
-
-
-
-
-
## Customers
-client.customers.list() -> SyncPagingIterable<Customer>
+client.customers.list() -> ListCustomersResponse
-
@@ -3897,7 +3694,9 @@ client.customers().bulkDeleteCustomers(
BulkDeleteCustomersRequest
.builder()
.customerIds(
- Arrays.asList("8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8")
+ new ArrayList(
+ Arrays.asList("8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8")
+ )
)
.build()
);
@@ -3960,7 +3759,9 @@ client.customers().bulkRetrieveCustomers(
BulkRetrieveCustomersRequest
.builder()
.customerIds(
- Arrays.asList("8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8")
+ new ArrayList(
+ Arrays.asList("8DDA5NZVBZFGAX0V3HPF81HHE0", "N18CPRVXR5214XPBBA6BZQWF3C", "2GYD7WNXF7BJZW1PMGNXZ3Y8M8")
+ )
)
.build()
);
@@ -4124,7 +3925,7 @@ client.customers().search(
CustomerCreationSourceFilter
.builder()
.values(
- Optional.of(
+ new ArrayList(
Arrays.asList(CustomerCreationSource.THIRD_PARTY)
)
)
@@ -4148,7 +3949,7 @@ client.customers().search(
FilterValue
.builder()
.all(
- Optional.of(
+ new ArrayList(
Arrays.asList("545AXB44B4XXWMVQ4W8SBT3HHF")
)
)
@@ -4194,7 +3995,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/build
-
-**limit:** `Optional`
+**limit:** `Optional`
The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.
If the specified limit is invalid, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 100.
@@ -4472,7 +4273,7 @@ format, where `YYYY` is the specified birth year or `0000` if a birth year is no
-
-**version:** `Optional`
+**version:** `Optional`
The current version of the customer profile.
@@ -4558,7 +4359,7 @@ client.customers().delete(
-
-**version:** `Optional`
+**version:** `Optional`
The current version of the customer profile.
@@ -4575,7 +4376,7 @@ As a best practice, you should include this parameter to enable [optimistic conc
## Devices
-client.devices.list() -> SyncPagingIterable<Device>
+client.devices.list() -> ListDevicesResponse
-
@@ -4730,7 +4531,7 @@ client.devices().get(
## Disputes
-client.disputes.list() -> SyncPagingIterable<Dispute>
+client.disputes.list() -> ListDisputesResponse
-
@@ -5151,7 +4952,7 @@ client.disputes().submitEvidence(
## Employees
-client.employees.list() -> SyncPagingIterable<Employee>
+client.employees.list() -> ListEmployeesResponse
-
@@ -5521,7 +5322,7 @@ client.events().listEventTypes(
## GiftCards
-client.giftCards.list() -> SyncPagingIterable<GiftCard>
+client.giftCards.list() -> ListGiftCardsResponse
-
@@ -6215,7 +6016,7 @@ client.inventory().deprecatedBatchChange(
.builder()
.idempotencyKey("8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe")
.changes(
- Optional.of(
+ new ArrayList(
Arrays.asList(
InventoryChange
.builder()
@@ -6297,22 +6098,22 @@ client.inventory().deprecatedBatchGetChanges(
BatchRetrieveInventoryChangesRequest
.builder()
.catalogObjectIds(
- Optional.of(
+ new ArrayList(
Arrays.asList("W62UWFY35CWMYGVWK6TWJDNI")
)
)
.locationIds(
- Optional.of(
+ new ArrayList(
Arrays.asList("C6W5YS5QM06F5")
)
)
.types(
- Optional.of(
+ new ArrayList(
Arrays.asList(InventoryChangeType.PHYSICAL_COUNT)
)
)
.states(
- Optional.of(
+ new ArrayList(
Arrays.asList(InventoryState.IN_STOCK)
)
)
@@ -6378,12 +6179,12 @@ client.inventory().deprecatedBatchGetCounts(
BatchGetInventoryCountsRequest
.builder()
.catalogObjectIds(
- Optional.of(
+ new ArrayList(
Arrays.asList("W62UWFY35CWMYGVWK6TWJDNI")
)
)
.locationIds(
- Optional.of(
+ new ArrayList(
Arrays.asList("59TNP9SA8VGDA")
)
)
@@ -6452,7 +6253,7 @@ client.inventory().batchCreateChanges(
.builder()
.idempotencyKey("8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe")
.changes(
- Optional.of(
+ new ArrayList(
Arrays.asList(
InventoryChange
.builder()
@@ -6502,7 +6303,7 @@ client.inventory().batchCreateChanges(
-client.inventory.batchGetChanges(request) -> SyncPagingIterable<InventoryChange>
+client.inventory.batchGetChanges(request) -> BatchGetInventoryChangesResponse
-
@@ -6540,22 +6341,22 @@ client.inventory().batchGetChanges(
BatchRetrieveInventoryChangesRequest
.builder()
.catalogObjectIds(
- Optional.of(
+ new ArrayList(
Arrays.asList("W62UWFY35CWMYGVWK6TWJDNI")
)
)
.locationIds(
- Optional.of(
+ new ArrayList(
Arrays.asList("C6W5YS5QM06F5")
)
)
.types(
- Optional.of(
+ new ArrayList(
Arrays.asList(InventoryChangeType.PHYSICAL_COUNT)
)
)
.states(
- Optional.of(
+ new ArrayList(
Arrays.asList(InventoryState.IN_STOCK)
)
)
@@ -6589,7 +6390,7 @@ client.inventory().batchGetChanges(
-client.inventory.batchGetCounts(request) -> SyncPagingIterable<InventoryCount>
+client.inventory.batchGetCounts(request) -> BatchGetInventoryCountsResponse
-
@@ -6630,12 +6431,12 @@ client.inventory().batchGetCounts(
BatchGetInventoryCountsRequest
.builder()
.catalogObjectIds(
- Optional.of(
+ new ArrayList(
Arrays.asList("W62UWFY35CWMYGVWK6TWJDNI")
)
)
.locationIds(
- Optional.of(
+ new ArrayList(
Arrays.asList("59TNP9SA8VGDA")
)
)
@@ -6854,7 +6655,7 @@ client.inventory().getTransfer(
-client.inventory.get(catalogObjectId) -> SyncPagingIterable<InventoryCount>
+client.inventory.get(catalogObjectId) -> GetInventoryCountResponse
-
@@ -6942,7 +6743,7 @@ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagin
-client.inventory.changes(catalogObjectId) -> SyncPagingIterable<InventoryChange>
+client.inventory.changes(catalogObjectId) -> GetInventoryChangesResponse
-
@@ -7040,7 +6841,7 @@ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagin
## Invoices
-client.invoices.list() -> SyncPagingIterable<Invoice>
+client.invoices.list() -> ListInvoicesResponse
-
@@ -7173,7 +6974,7 @@ client.invoices().create(
.build()
)
.paymentRequests(
- Optional.of(
+ new ArrayList(
Arrays.asList(
InvoicePaymentRequest
.builder()
@@ -7182,7 +6983,7 @@ client.invoices().create(
.tippingEnabled(true)
.automaticPaymentSource(InvoiceAutomaticPaymentSource.NONE)
.reminders(
- Optional.of(
+ new ArrayList(
Arrays.asList(
InvoicePaymentReminder
.builder()
@@ -7212,7 +7013,7 @@ client.invoices().create(
.build()
)
.customFields(
- Optional.of(
+ new ArrayList(
Arrays.asList(
InvoiceCustomField
.builder()
@@ -7319,10 +7120,12 @@ client.invoices().search(
InvoiceFilter
.builder()
.locationIds(
- Arrays.asList("ES0RJRZYEC39A")
+ new ArrayList(
+ Arrays.asList("ES0RJRZYEC39A")
+ )
)
.customerIds(
- Optional.of(
+ new ArrayList(
Arrays.asList("JDKYHBWT1D4F8MFH63DBMEN8Y4")
)
)
@@ -7488,7 +7291,7 @@ client.invoices().update(
.builder()
.version(1)
.paymentRequests(
- Optional.of(
+ new ArrayList(
Arrays.asList(
InvoicePaymentRequest
.builder()
@@ -8579,7 +8382,7 @@ client.labor().createTimecard(
.build()
)
.breaks(
- Optional.of(
+ new ArrayList(
Arrays.asList(
Break
.builder()
@@ -8869,7 +8672,7 @@ client.labor().updateTimecard(
.build()
)
.breaks(
- Optional.of(
+ new ArrayList(
Arrays.asList(
Break
.builder()
@@ -9216,7 +9019,7 @@ client.locations().update(
BusinessHours
.builder()
.periods(
- Optional.of(
+ new ArrayList(
Arrays.asList(
BusinessHoursPeriod
.builder()
@@ -9328,14 +9131,14 @@ client.locations().checkouts(
.referenceId("reference_id")
.customerId("customer_id")
.lineItems(
- Optional.of(
+ new ArrayList(
Arrays.asList(
OrderLineItem
.builder()
.quantity("2")
.name("Printed T Shirt")
.appliedTaxes(
- Optional.of(
+ new ArrayList(
Arrays.asList(
OrderLineItemAppliedTax
.builder()
@@ -9345,7 +9148,7 @@ client.locations().checkouts(
)
)
.appliedDiscounts(
- Optional.of(
+ new ArrayList(
Arrays.asList(
OrderLineItemAppliedDiscount
.builder()
@@ -9390,7 +9193,7 @@ client.locations().checkouts(
)
)
.taxes(
- Optional.of(
+ new ArrayList(
Arrays.asList(
OrderLineItemTax
.builder()
@@ -9403,7 +9206,7 @@ client.locations().checkouts(
)
)
.discounts(
- Optional.of(
+ new ArrayList(
Arrays.asList(
OrderLineItemDiscount
.builder()
@@ -9444,7 +9247,7 @@ client.locations().checkouts(
)
.redirectUrl("https://merchant.website.com/order-confirm")
.additionalRecipients(
- Optional.of(
+ new ArrayList(
Arrays.asList(
ChargeRequestAdditionalRecipient
.builder()
@@ -9738,7 +9541,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/build
## Merchants
-client.merchants.list() -> SyncPagingIterable<Merchant>
+client.merchants.list() -> ListMerchantsResponse
-
@@ -10145,7 +9948,7 @@ client.orders().create(
.locationId("057P5VYJ4A5X1")
.referenceId("my-order-001")
.lineItems(
- Optional.of(
+ new ArrayList(
Arrays.asList(
OrderLineItem
.builder()
@@ -10164,7 +9967,7 @@ client.orders().create(
.quantity("2")
.catalogObjectId("BEMYCSMIJL46OCDV4KYIKXIB")
.modifiers(
- Optional.of(
+ new ArrayList(
Arrays.asList(
OrderLineItemModifier
.builder()
@@ -10174,7 +9977,7 @@ client.orders().create(
)
)
.appliedDiscounts(
- Optional.of(
+ new ArrayList(
Arrays.asList(
OrderLineItemAppliedDiscount
.builder()
@@ -10188,7 +9991,7 @@ client.orders().create(
)
)
.taxes(
- Optional.of(
+ new ArrayList(
Arrays.asList(
OrderLineItemTax
.builder()
@@ -10201,7 +10004,7 @@ client.orders().create(
)
)
.discounts(
- Optional.of(
+ new ArrayList(
Arrays.asList(
OrderLineItemDiscount
.builder()
@@ -10296,7 +10099,9 @@ client.orders().batchGet(
BatchGetOrdersRequest
.builder()
.orderIds(
- Arrays.asList("CAISEM82RcpmcFBM0TfOyiHV3es", "CAISENgvlJ6jLWAzERDzjyHVybY")
+ new ArrayList(
+ Arrays.asList("CAISEM82RcpmcFBM0TfOyiHV3es", "CAISENgvlJ6jLWAzERDzjyHVybY")
+ )
)
.locationId("057P5VYJ4A5X1")
.build()
@@ -10373,7 +10178,7 @@ client.orders().calculate(
.builder()
.locationId("D7AVYMEAPJ3A3")
.lineItems(
- Optional.of(
+ new ArrayList(
Arrays.asList(
OrderLineItem
.builder()
@@ -10403,7 +10208,7 @@ client.orders().calculate(
)
)
.discounts(
- Optional.of(
+ new ArrayList(
Arrays.asList(
OrderLineItemDiscount
.builder()
@@ -10597,7 +10402,7 @@ client.orders().search(
SearchOrdersRequest
.builder()
.locationIds(
- Optional.of(
+ new ArrayList(
Arrays.asList("057P5VYJ4A5X1", "18YC4JDH91E1H")
)
)
@@ -10611,7 +10416,9 @@ client.orders().search(
SearchOrdersStateFilter
.builder()
.states(
- Arrays.asList(OrderState.COMPLETED)
+ new ArrayList(
+ Arrays.asList(OrderState.COMPLETED)
+ )
)
.build()
)
@@ -10832,7 +10639,7 @@ client.orders().update(
.builder()
.locationId("location_id")
.lineItems(
- Optional.of(
+ new ArrayList(
Arrays.asList(
OrderLineItem
.builder()
@@ -10854,7 +10661,7 @@ client.orders().update(
.build()
)
.fieldsToClear(
- Optional.of(
+ new ArrayList(
Arrays.asList("discounts")
)
)
@@ -10974,7 +10781,7 @@ client.orders().pay(
.orderId("order_id")
.idempotencyKey("c043a359-7ad9-4136-82a9-c3f1d66dcbff")
.paymentIds(
- Optional.of(
+ new ArrayList(
Arrays.asList("EnZdNAlWCmfh6Mt5FMNST1o7taB", "0LRiVlbXVwe8ozu4KbZxd12mvaB")
)
)
@@ -11040,7 +10847,7 @@ The payment total must match the order total.
## Payments
-client.payments.list() -> SyncPagingIterable<Payment>
+client.payments.list() -> ListPaymentsResponse
-
@@ -11108,7 +10915,7 @@ client.payments().list(
**beginTime:** `Optional`
-Indicates the start of the time range to retrieve payments for, in RFC 3339 format.
+Indicates the start of the time range to retrieve payments for, in RFC 3339 format.
The range is determined using the `created_at` field for each Payment.
Inclusive. Default: The current time minus one year.
@@ -11120,7 +10927,7 @@ Inclusive. Default: The current time minus one year.
**endTime:** `Optional`
-Indicates the end of the time range to retrieve payments for, in RFC 3339 format. The
+Indicates the end of the time range to retrieve payments for, in RFC 3339 format. The
range is determined using the `created_at` field for each Payment.
Default: The current time.
@@ -11167,7 +10974,7 @@ for the default (main) location associated with the seller.
-
-**total:** `Optional` — The exact amount in the `total_money` for a payment.
+**total:** `Optional` — The exact amount in the `total_money` for a payment.
@@ -11360,7 +11167,7 @@ This could be a payment token generated by the Web Payments SDK for any of its
[supported methods](https://developer.squareup.com/docs/web-payments/overview#explore-payment-methods),
including cards, bank transfers, Afterpay or Cash App Pay. If recording a payment
that the seller received outside of Square, specify either "CASH" or "EXTERNAL".
-For more information, see
+For more information, see
[Take Payments](https://developer.squareup.com/docs/payments-api/take-payments).
@@ -11448,10 +11255,10 @@ For more information, see [Permissions](https://developer.squareup.com/docs/paym
**delayDuration:** `Optional`
-The duration of time after the payment's creation when Square automatically
-either completes or cancels the payment depending on the `delay_action` field value.
-For more information, see
-[Time threshold](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture#time-threshold).
+The duration of time after the payment's creation when Square automatically
+either completes or cancels the payment depending on the `delay_action` field value.
+For more information, see
+[Time threshold](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture#time-threshold).
This parameter should be specified as a time duration, in RFC 3339 format.
@@ -11472,8 +11279,8 @@ Default:
**delayAction:** `Optional`
The action to be applied to the payment when the `delay_duration` has elapsed. The action must be
-CANCEL or COMPLETE. For more information, see
-[Time Threshold](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture#time-threshold).
+CANCEL or COMPLETE. For more information, see
+[Time Threshold](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture#time-threshold).
Default: CANCEL
@@ -11531,7 +11338,7 @@ used.
**teamMemberId:** `Optional`
-An optional [TeamMember](entity:TeamMember) ID to associate with
+An optional [TeamMember](entity:TeamMember) ID to associate with
this payment.
@@ -11544,7 +11351,7 @@ this payment.
A user-defined ID to associate with the payment.
-You can use this field to associate the payment to an entity in an external system
+You can use this field to associate the payment to an entity in an external system
(for example, you might specify an order ID that is generated by a third-party shopping cart).
@@ -12038,8 +11845,8 @@ client.payments().complete(
**versionToken:** `Optional`
-Used for optimistic concurrency. This opaque token identifies the current `Payment`
-version that the caller expects. If the server has a different version of the Payment,
+Used for optimistic concurrency. This opaque token identifies the current `Payment`
+version that the caller expects. If the server has a different version of the Payment,
the update fails and a response with a VERSION_MISMATCH error is returned.
@@ -12053,7 +11860,7 @@ the update fails and a response with a VERSION_MISMATCH error is returned.
## Payouts
-client.payouts.list() -> SyncPagingIterable<Payout>
+client.payouts.list() -> ListPayoutsResponse
-
@@ -12248,7 +12055,7 @@ client.payouts().get(
-client.payouts.listEntries(payoutId) -> SyncPagingIterable<PayoutEntry>
+client.payouts.listEntries(payoutId) -> ListPayoutEntriesResponse
-
@@ -12347,7 +12154,7 @@ Default: `100`
## Refunds
-client.refunds.list() -> SyncPagingIterable<PaymentRefund>
+client.refunds.list() -> ListPaymentRefundsResponse
-
@@ -13153,7 +12960,7 @@ client.subscriptions().create(
.build()
)
.phases(
- Optional.of(
+ new ArrayList(
Arrays.asList(
Phase
.builder()
@@ -13237,7 +13044,7 @@ If the cancellation date is earlier than the end date of a subscription cycle, t
at the canceled date and the subscriber is sent a prorated invoice at the beginning of the canceled cycle.
When the subscription plan of the newly created subscription has a fixed number of cycles and the `canceled_date`
-occurs before the subscription plan completes, the specified `canceled_date` sets the date when the subscription
+occurs before the subscription plan expires, the specified `canceled_date` sets the date when the subscription
stops through the end of the last cycle.
@@ -13459,17 +13266,17 @@ client.subscriptions().search(
SearchSubscriptionsFilter
.builder()
.customerIds(
- Optional.of(
+ new ArrayList(
Arrays.asList("CHFGVKYY8RSV93M5KCYTG4PN0G")
)
)
.locationIds(
- Optional.of(
+ new ArrayList(
Arrays.asList("S8GWD5R9QB376")
)
)
.sourceNames(
- Optional.of(
+ new ArrayList(
Arrays.asList("My App")
)
)
@@ -13912,7 +13719,7 @@ client.subscriptions().cancel(
-client.subscriptions.listEvents(subscriptionId) -> SyncPagingIterable<SubscriptionEvent>
+client.subscriptions.listEvents(subscriptionId) -> ListSubscriptionEventsResponse
-
@@ -14066,7 +13873,7 @@ on the starting date of the next billing cycle.
-
-**pauseCycleDuration:** `Optional`
+**pauseCycleDuration:** `Optional`
The number of billing cycles the subscription will be paused before it is reactivated.
@@ -14228,7 +14035,7 @@ client.subscriptions().swapPlan(
.subscriptionId("subscription_id")
.newPlanVariationId("FQ7CDXXWSLUJRPM3GFJSJGZ7")
.phases(
- Optional.of(
+ new ArrayList(
Arrays.asList(
PhaseInput
.builder()
@@ -14337,7 +14144,7 @@ client.teamMembers().create(
.builder()
.assignmentType(TeamMemberAssignedLocationsAssignmentType.EXPLICIT_LOCATIONS)
.locationIds(
- Optional.of(
+ new ArrayList(
Arrays.asList("YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT")
)
)
@@ -14347,7 +14154,7 @@ client.teamMembers().create(
WageSetting
.builder()
.jobAssignments(
- Optional.of(
+ new ArrayList(
Arrays.asList(
JobAssignment
.builder()
@@ -14465,7 +14272,9 @@ client.teamMembers().batchCreate(
.assignmentType(Optional.of(TeamMemberAssignedLocationsAssignmentType.EXPLICIT_LOCATIONS))
.locationIds(
Optional.of(
- Arrays.asList("YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT")
+ new ArrayList(
+ Arrays.asList("YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT")
+ )
)
)
.build()
@@ -14615,7 +14424,9 @@ client.teamMembers().batchUpdate(
.assignmentType(Optional.of(TeamMemberAssignedLocationsAssignmentType.EXPLICIT_LOCATIONS))
.locationIds(
Optional.of(
- Arrays.asList("YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT")
+ new ArrayList(
+ Arrays.asList("YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT")
+ )
)
)
.build()
@@ -14701,7 +14512,7 @@ client.teamMembers().search(
SearchTeamMembersFilter
.builder()
.locationIds(
- Optional.of(
+ new ArrayList(
Arrays.asList("0G5P3VGACMMQZ")
)
)
@@ -14867,7 +14678,7 @@ client.teamMembers().update(
.builder()
.assignmentType(TeamMemberAssignedLocationsAssignmentType.EXPLICIT_LOCATIONS)
.locationIds(
- Optional.of(
+ new ArrayList(
Arrays.asList("YSGH2WBKG94QZ", "GA2Y9HSJ8KRYT")
)
)
@@ -14877,7 +14688,7 @@ client.teamMembers().update(
WageSetting
.builder()
.jobAssignments(
- Optional.of(
+ new ArrayList(
Arrays.asList(
JobAssignment
.builder()
@@ -15411,8 +15222,8 @@ client.terminal().dismissTerminalRefund(
-## TransferOrders
-client.transferOrders.create(request) -> CreateTransferOrderResponse
+## Vendors
+client.vendors.batchCreate(request) -> BatchCreateVendorsResponse
-
@@ -15424,26 +15235,7 @@ client.terminal().dismissTerminalRefund(
-
-Creates a new transfer order in [DRAFT](entity:TransferOrderStatus) status. A transfer order represents the intent
-to move [CatalogItemVariation](entity:CatalogItemVariation)s from one [Location](entity:Location) to another.
-The source and destination locations must be different and must belong to your Square account.
-
-In [DRAFT](entity:TransferOrderStatus) status, you can:
-- Add or remove items
-- Modify quantities
-- Update shipping information
-- Delete the entire order via [DeleteTransferOrder](api-endpoint:TransferOrders-DeleteTransferOrder)
-
-The request requires source_location_id and destination_location_id.
-Inventory levels are not affected until the order is started via
-[StartTransferOrder](api-endpoint:TransferOrders-StartTransferOrder).
-
-Common integration points:
-- Sync with warehouse management systems
-- Automate regular stock transfers
-- Initialize transfers from inventory optimization systems
-
-Creates a [transfer_order.created](webhook:transfer_order.created) webhook event.
+Creates one or more [Vendor](entity:Vendor) objects to represent suppliers to a seller.
@@ -15458,776 +15250,8 @@ Creates a [transfer_order.created](webhook:transfer_order.created) webhook event
-
```java
-client.transferOrders().create(
- CreateTransferOrderRequest
- .builder()
- .idempotencyKey("65cc0586-3e82-384s-b524-3885cffd52")
- .transferOrder(
- CreateTransferOrderData
- .builder()
- .sourceLocationId("EXAMPLE_SOURCE_LOCATION_ID_123")
- .destinationLocationId("EXAMPLE_DEST_LOCATION_ID_456")
- .expectedAt("2025-11-09T05:00:00Z")
- .notes("Example transfer order for inventory redistribution between locations")
- .trackingNumber("TRACK123456789")
- .createdByTeamMemberId("EXAMPLE_TEAM_MEMBER_ID_789")
- .lineItems(
- Optional.of(
- Arrays.asList(
- CreateTransferOrderLineData
- .builder()
- .itemVariationId("EXAMPLE_ITEM_VARIATION_ID_001")
- .quantityOrdered("5")
- .build(),
- CreateTransferOrderLineData
- .builder()
- .itemVariationId("EXAMPLE_ITEM_VARIATION_ID_002")
- .quantityOrdered("3")
- .build()
- )
- )
- )
- .build()
- )
- .build()
-);
-```
-
-
-
-
-
-#### ⚙️ Parameters
-
-
--
-
-
--
-
-**idempotencyKey:** `String`
-
-A unique string that identifies this CreateTransferOrder request. Keys can be
-any valid string but must be unique for every CreateTransferOrder request.
-
-
-
-
-
--
-
-**transferOrder:** `CreateTransferOrderData` — The transfer order to create
-
-
-
-
-
-
-
-
-
-
-
-client.transferOrders.search(request) -> SyncPagingIterable<TransferOrder>
-
--
-
-#### 📝 Description
-
-
--
-
-
--
-
-Searches for transfer orders using filters. Returns a paginated list of matching
-[TransferOrder](entity:TransferOrder)s sorted by creation date.
-
-Common search scenarios:
-- Find orders for a source [Location](entity:Location)
-- Find orders for a destination [Location](entity:Location)
-- Find orders in a particular [TransferOrderStatus](entity:TransferOrderStatus)
-
-
-
-
-
-#### 🔌 Usage
-
-
--
-
-
--
-
-```java
-client.transferOrders().search(
- SearchTransferOrdersRequest
- .builder()
- .query(
- TransferOrderQuery
- .builder()
- .filter(
- TransferOrderFilter
- .builder()
- .sourceLocationIds(
- Optional.of(
- Arrays.asList("EXAMPLE_SOURCE_LOCATION_ID_123")
- )
- )
- .destinationLocationIds(
- Optional.of(
- Arrays.asList("EXAMPLE_DEST_LOCATION_ID_456")
- )
- )
- .statuses(
- Optional.of(
- Arrays.asList(TransferOrderStatus.STARTED, TransferOrderStatus.PARTIALLY_RECEIVED)
- )
- )
- .build()
- )
- .sort(
- TransferOrderSort
- .builder()
- .field(TransferOrderSortField.UPDATED_AT)
- .order(SortOrder.DESC)
- .build()
- )
- .build()
- )
- .cursor("eyJsYXN0X3VwZGF0ZWRfYXQiOjE3NTMxMTg2NjQ4NzN9")
- .limit(10)
- .build()
-);
-```
-
-
-
-
-
-#### ⚙️ Parameters
-
-
--
-
-
--
-
-**query:** `Optional` — The search query
-
-
-
-
-
--
-
-**cursor:** `Optional` — Pagination cursor from a previous search response
-
-
-
-
-
--
-
-**limit:** `Optional` — Maximum number of results to return (1-100)
-
-
-
-
-
-
-
-
-
-
-
-client.transferOrders.get(transferOrderId) -> RetrieveTransferOrderResponse
-
--
-
-#### 📝 Description
-
-
--
-
-
--
-
-Retrieves a specific [TransferOrder](entity:TransferOrder) by ID. Returns the complete
-order details including:
-
-- Basic information (status, dates, notes)
-- Line items with ordered and received quantities
-- Source and destination [Location](entity:Location)s
-- Tracking information (if available)
-
-
-
-
-
-#### 🔌 Usage
-
-
--
-
-
--
-
-```java
-client.transferOrders().get(
- GetTransferOrdersRequest
- .builder()
- .transferOrderId("transfer_order_id")
- .build()
-);
-```
-
-
-
-
-
-#### ⚙️ Parameters
-
-
--
-
-
--
-
-**transferOrderId:** `String` — The ID of the transfer order to retrieve
-
-
-
-
-
-
-
-
-
-
-
-client.transferOrders.update(transferOrderId, request) -> UpdateTransferOrderResponse
-
--
-
-#### 📝 Description
-
-
--
-
-
--
-
-Updates an existing transfer order. This endpoint supports sparse updates,
-allowing you to modify specific fields without affecting others.
-
-Creates a [transfer_order.updated](webhook:transfer_order.updated) webhook event.
-
-
-
-
-
-#### 🔌 Usage
-
-
--
-
-
--
-
-```java
-client.transferOrders().update(
- UpdateTransferOrderRequest
- .builder()
- .transferOrderId("transfer_order_id")
- .idempotencyKey("f47ac10b-58cc-4372-a567-0e02b2c3d479")
- .transferOrder(
- UpdateTransferOrderData
- .builder()
- .sourceLocationId("EXAMPLE_SOURCE_LOCATION_ID_789")
- .destinationLocationId("EXAMPLE_DEST_LOCATION_ID_101")
- .expectedAt("2025-11-10T08:00:00Z")
- .notes("Updated: Priority transfer due to low stock at destination")
- .trackingNumber("TRACK987654321")
- .lineItems(
- Optional.of(
- Arrays.asList(
- UpdateTransferOrderLineData
- .builder()
- .uid("1")
- .quantityOrdered("7")
- .build(),
- UpdateTransferOrderLineData
- .builder()
- .itemVariationId("EXAMPLE_NEW_ITEM_VARIATION_ID_003")
- .quantityOrdered("2")
- .build(),
- UpdateTransferOrderLineData
- .builder()
- .uid("2")
- .remove(true)
- .build()
- )
- )
- )
- .build()
- )
- .version(1753109537351L)
- .build()
-);
-```
-
-
-
-
-
-#### ⚙️ Parameters
-
-
--
-
-
--
-
-**transferOrderId:** `String` — The ID of the transfer order to update
-
-
-
-
-
--
-
-**idempotencyKey:** `String` — A unique string that identifies this UpdateTransferOrder request. Keys must contain only alphanumeric characters, dashes and underscores
-
-
-
-
-
--
-
-**transferOrder:** `UpdateTransferOrderData` — The transfer order updates to apply
-
-
-
-
-
--
-
-**version:** `Optional` — Version for optimistic concurrency
-
-
-
-
-
-
-
-
-
-
-
-client.transferOrders.delete(transferOrderId) -> DeleteTransferOrderResponse
-
--
-
-#### 📝 Description
-
-
--
-
-
--
-
-Deletes a transfer order in [DRAFT](entity:TransferOrderStatus) status.
-Only draft orders can be deleted. Once an order is started via
-[StartTransferOrder](api-endpoint:TransferOrders-StartTransferOrder), it can no longer be deleted.
-
-Creates a [transfer_order.deleted](webhook:transfer_order.deleted) webhook event.
-
-
-
-
-
-#### 🔌 Usage
-
-
--
-
-
--
-
-```java
-client.transferOrders().delete(
- DeleteTransferOrdersRequest
- .builder()
- .transferOrderId("transfer_order_id")
- .version(1000000L)
- .build()
-);
-```
-
-
-
-
-
-#### ⚙️ Parameters
-
-
--
-
-
--
-
-**transferOrderId:** `String` — The ID of the transfer order to delete
-
-
-
-
-
--
-
-**version:** `Optional` — Version for optimistic concurrency
-
-
-
-
-
-
-
-
-
-
-
-client.transferOrders.cancel(transferOrderId, request) -> CancelTransferOrderResponse
-
--
-
-#### 📝 Description
-
-
--
-
-
--
-
-Cancels a transfer order in [STARTED](entity:TransferOrderStatus) or
-[PARTIALLY_RECEIVED](entity:TransferOrderStatus) status. Any unreceived quantities will no
-longer be receivable and will be immediately returned to the source [Location](entity:Location)'s inventory.
-
-Common reasons for cancellation:
-- Items no longer needed at destination
-- Source location needs the inventory
-- Order created in error
-
-Creates a [transfer_order.updated](webhook:transfer_order.updated) webhook event.
-
-
-
-
-
-#### 🔌 Usage
-
-
--
-
-
--
-
-```java
-client.transferOrders().cancel(
- CancelTransferOrderRequest
- .builder()
- .transferOrderId("transfer_order_id")
- .idempotencyKey("65cc0586-3e82-4d08-b524-3885cffd52")
- .version(1753117449752L)
- .build()
-);
-```
-
-
-
-
-
-#### ⚙️ Parameters
-
-
--
-
-
--
-
-**transferOrderId:** `String` — The ID of the transfer order to cancel. Must be in STARTED or PARTIALLY_RECEIVED status.
-
-
-
-
-
--
-
-**idempotencyKey:** `String`
-
-A unique string that identifies this UpdateTransferOrder request. Keys can be
-any valid string but must be unique for every UpdateTransferOrder request.
-
-
-
-
-
--
-
-**version:** `Optional` — Version for optimistic concurrency
-
-
-
-
-
-
-
-
-
-
-
-client.transferOrders.receive(transferOrderId, request) -> ReceiveTransferOrderResponse
-
--
-
-#### 📝 Description
-
-
--
-
-
--
-
-Records receipt of [CatalogItemVariation](entity:CatalogItemVariation)s for a transfer order.
-This endpoint supports partial receiving - you can receive items in multiple batches.
-
-For each line item, you can specify:
-- Quantity received in good condition (added to destination inventory with [InventoryState](entity:InventoryState) of IN_STOCK)
-- Quantity damaged during transit/handling (added to destination inventory with [InventoryState](entity:InventoryState) of WASTE)
-- Quantity canceled (returned to source location's inventory)
-
-The order must be in [STARTED](entity:TransferOrderStatus) or [PARTIALLY_RECEIVED](entity:TransferOrderStatus) status.
-Received quantities are added to the destination [Location](entity:Location)'s inventory according to their condition.
-Canceled quantities are immediately returned to the source [Location](entity:Location)'s inventory.
-
-When all items are either received, damaged, or canceled, the order moves to
-[COMPLETED](entity:TransferOrderStatus) status.
-
-Creates a [transfer_order.updated](webhook:transfer_order.updated) webhook event.
-
-
-
-
-
-#### 🔌 Usage
-
-
--
-
-
--
-
-```java
-client.transferOrders().receive(
- ReceiveTransferOrderRequest
- .builder()
- .transferOrderId("transfer_order_id")
- .idempotencyKey("EXAMPLE_IDEMPOTENCY_KEY_101")
- .receipt(
- TransferOrderGoodsReceipt
- .builder()
- .lineItems(
- Optional.of(
- Arrays.asList(
- TransferOrderGoodsReceiptLineItem
- .builder()
- .transferOrderLineUid("transfer_order_line_uid")
- .quantityReceived("3")
- .quantityDamaged("1")
- .quantityCanceled("1")
- .build(),
- TransferOrderGoodsReceiptLineItem
- .builder()
- .transferOrderLineUid("transfer_order_line_uid")
- .quantityReceived("2")
- .quantityCanceled("1")
- .build()
- )
- )
- )
- .build()
- )
- .version(1753118664873L)
- .build()
-);
-```
-
-
-
-
-
-#### ⚙️ Parameters
-
-
--
-
-
--
-
-**transferOrderId:** `String` — The ID of the transfer order to receive items for
-
-
-
-
-
--
-
-**idempotencyKey:** `String` — A unique key to make this request idempotent
-
-
-
-
-
--
-
-**receipt:** `TransferOrderGoodsReceipt` — The receipt details
-
-
-
-
-
--
-
-**version:** `Optional` — Version for optimistic concurrency
-
-
-
-
-
-
-
-
-
-
-
-client.transferOrders.start(transferOrderId, request) -> StartTransferOrderResponse
-
--
-
-#### 📝 Description
-
-
--
-
-
--
-
-Changes a [DRAFT](entity:TransferOrderStatus) transfer order to [STARTED](entity:TransferOrderStatus) status.
-This decrements inventory at the source [Location](entity:Location) and marks it as in-transit.
-
-The order must be in [DRAFT](entity:TransferOrderStatus) status and have all required fields populated.
-Once started, the order can no longer be deleted, but it can be canceled via
-[CancelTransferOrder](api-endpoint:TransferOrders-CancelTransferOrder).
-
-Creates a [transfer_order.updated](webhook:transfer_order.updated) webhook event.
-
-
-
-
-
-#### 🔌 Usage
-
-
--
-
-
--
-
-```java
-client.transferOrders().start(
- StartTransferOrderRequest
- .builder()
- .transferOrderId("transfer_order_id")
- .idempotencyKey("EXAMPLE_IDEMPOTENCY_KEY_789")
- .version(1753109537351L)
- .build()
-);
-```
-
-
-
-
-
-#### ⚙️ Parameters
-
-
--
-
-
--
-
-**transferOrderId:** `String` — The ID of the transfer order to start. Must be in DRAFT status.
-
-
-
-
-
--
-
-**idempotencyKey:** `String`
-
-A unique string that identifies this UpdateTransferOrder request. Keys can be
-any valid string but must be unique for every UpdateTransferOrder request.
-
-
-
-
-
--
-
-**version:** `Optional` — Version for optimistic concurrency
-
-
-
-
-
-
-
-
-
-
-
-## Vendors
-client.vendors.batchCreate(request) -> BatchCreateVendorsResponse
-
--
-
-#### 📝 Description
-
-
--
-
-
--
-
-Creates one or more [Vendor](entity:Vendor) objects to represent suppliers to a seller.
-
-
-
-
-
-#### 🔌 Usage
-
-
--
-
-
--
-
-```java
-client.vendors().batchCreate(
- BatchCreateVendorsRequest
+client.vendors().batchCreate(
+ BatchCreateVendorsRequest
.builder()
.vendors(
new HashMap() {{
@@ -16249,14 +15273,16 @@ client.vendors().batchCreate(
)
.contacts(
Optional.of(
- Arrays.asList(
- VendorContact
- .builder()
- .ordinal(1)
- .name("Joe Burrow")
- .emailAddress("joe@joesfreshseafood.com")
- .phoneNumber("1-212-555-4250")
- .build()
+ new ArrayList(
+ Arrays.asList(
+ VendorContact
+ .builder()
+ .ordinal(1)
+ .name("Joe Burrow")
+ .emailAddress("joe@joesfreshseafood.com")
+ .phoneNumber("1-212-555-4250")
+ .build()
+ )
)
)
)
@@ -16324,7 +15350,7 @@ client.vendors().batchGet(
BatchGetVendorsRequest
.builder()
.vendorIds(
- Optional.of(
+ new ArrayList(
Arrays.asList("INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4")
)
)
@@ -16484,7 +15510,7 @@ client.vendors().create(
.build()
)
.contacts(
- Optional.of(
+ new ArrayList(
Arrays.asList(
VendorContact
.builder()
@@ -16763,7 +15789,7 @@ client.vendors().update(
## Bookings CustomAttributeDefinitions
-client.bookings.customAttributeDefinitions.list() -> SyncPagingIterable<CustomAttributeDefinition>
+client.bookings.customAttributeDefinitions.list() -> ListBookingCustomAttributeDefinitionsResponse
-
@@ -17343,7 +16369,7 @@ information needed to create or update a custom attribute.
-client.bookings.customAttributes.list(bookingId) -> SyncPagingIterable<CustomAttribute>
+client.bookings.customAttributes.list(bookingId) -> ListBookingCustomAttributesResponse
-
@@ -17736,7 +16762,7 @@ definition owner, you must use the qualified key.
## Bookings LocationProfiles
-client.bookings.locationProfiles.list() -> SyncPagingIterable<LocationBookingProfile>
+client.bookings.locationProfiles.list() -> ListLocationBookingProfilesResponse
-
@@ -17805,7 +16831,7 @@ client.bookings().locationProfiles().list(
## Bookings TeamMemberProfiles
-client.bookings.teamMemberProfiles.list() -> SyncPagingIterable<TeamMemberBookingProfile>
+client.bookings.teamMemberProfiles.list() -> ListTeamMemberBookingProfilesResponse
-
@@ -17951,7 +16977,7 @@ client.bookings().teamMemberProfiles().get(
## CashDrawers Shifts
-client.cashDrawers.shifts.list() -> SyncPagingIterable<CashDrawerShiftSummary>
+client.cashDrawers.shifts.list() -> ListCashDrawerShiftsResponse
-
@@ -18131,7 +17157,7 @@ client.cashDrawers().shifts().get(
-client.cashDrawers.shifts.listEvents(shiftId) -> SyncPagingIterable<CashDrawerShiftEvent>
+client.cashDrawers.shifts.listEvents(shiftId) -> ListCashDrawerShiftEventsResponse
-
@@ -18514,7 +17540,7 @@ Default value: `false`
-
-**catalogVersion:** `Optional`
+**catalogVersion:** `Optional`
Requests objects as of a specific version of the catalog. This allows you to retrieve historical
versions of objects. The value to retrieve a specific version of an object can be found
@@ -18617,7 +17643,7 @@ catalog item will delete its catalog item variations).
## Checkout PaymentLinks
-client.checkout.paymentLinks.list() -> SyncPagingIterable<PaymentLink>
+client.checkout.paymentLinks.list() -> ListPaymentLinksResponse
-
@@ -19044,7 +18070,7 @@ client.checkout().paymentLinks().delete(
## Customers CustomAttributeDefinitions
-client.customers.customAttributeDefinitions.list() -> SyncPagingIterable<CustomAttributeDefinition>
+client.customers.customAttributeDefinitions.list() -> ListCustomerCustomAttributeDefinitionsResponse
-
@@ -19611,7 +18637,7 @@ information needed to create or update a custom attribute.
## Customers Groups
-client.customers.groups.list() -> SyncPagingIterable<CustomerGroup>
+client.customers.groups.list() -> ListCustomerGroupsResponse
-
@@ -20097,7 +19123,7 @@ client.customers().groups().remove(
## Customers Segments
-client.customers.segments.list() -> SyncPagingIterable<CustomerSegment>
+client.customers.segments.list() -> ListCustomerSegmentsResponse
-
@@ -20431,7 +19457,7 @@ client.customers().cards().delete(
## Customers CustomAttributes
-client.customers.customAttributes.list(customerId) -> SyncPagingIterable<CustomAttribute>
+client.customers.customAttributes.list(customerId) -> ListCustomerCustomAttributesResponse
-
@@ -20833,7 +19859,7 @@ definition owner, you must use the qualified key.
## Devices Codes
-client.devices.codes.list() -> SyncPagingIterable<DeviceCode>
+client.devices.codes.list() -> ListDeviceCodesResponse
-
@@ -21074,7 +20100,7 @@ client.devices().codes().get(
## Disputes Evidence
-client.disputes.evidence.list(disputeId) -> SyncPagingIterable<DisputeEvidence>
+client.disputes.evidence.list(disputeId) -> ListDisputeEvidenceResponse
-
@@ -21286,7 +20312,7 @@ client.disputes().evidence().delete(
## GiftCards Activities
-client.giftCards.activities.list() -> SyncPagingIterable<GiftCardActivity>
+client.giftCards.activities.list() -> ListGiftCardActivitiesResponse
-
@@ -21527,7 +20553,7 @@ gift card, the `location_id` where the activity occurred, and the activity `type
## Labor BreakTypes
-client.labor.breakTypes.list() -> SyncPagingIterable<BreakType>
+client.labor.breakTypes.list() -> ListBreakTypesResponse
-
@@ -21897,7 +20923,7 @@ client.labor().breakTypes().delete(
## Labor EmployeeWages
-client.labor.employeeWages.list() -> SyncPagingIterable<EmployeeWage>
+client.labor.employeeWages.list() -> ListEmployeeWagesResponse
-
@@ -22105,7 +21131,7 @@ client.labor().shifts().create(
.build()
)
.breaks(
- Optional.of(
+ new ArrayList(
Arrays.asList(
Break
.builder()
@@ -22395,7 +21421,7 @@ client.labor().shifts().update(
.build()
)
.breaks(
- Optional.of(
+ new ArrayList(
Arrays.asList(
Break
.builder()
@@ -22517,7 +21543,7 @@ client.labor().shifts().delete(
## Labor TeamMemberWages
-client.labor.teamMemberWages.list() -> SyncPagingIterable<TeamMemberWage>
+client.labor.teamMemberWages.list() -> ListTeamMemberWagesResponse
-
@@ -22660,7 +21686,7 @@ client.labor().teamMemberWages().get(
## Labor WorkweekConfigs
-client.labor.workweekConfigs.list() -> SyncPagingIterable<WorkweekConfig>
+client.labor.workweekConfigs.list() -> ListWorkweekConfigsResponse
-
@@ -22804,7 +21830,7 @@ client.labor().workweekConfigs().get(
## Locations CustomAttributeDefinitions
-client.locations.customAttributeDefinitions.list() -> SyncPagingIterable<CustomAttributeDefinition>
+client.locations.customAttributeDefinitions.list() -> ListLocationCustomAttributeDefinitionsResponse
-
@@ -23418,7 +22444,7 @@ information needed to create or update a custom attribute.
-client.locations.customAttributes.list(locationId) -> SyncPagingIterable<CustomAttribute>
+client.locations.customAttributes.list(locationId) -> ListLocationCustomAttributesResponse
-
@@ -24274,7 +23300,7 @@ client.loyalty().accounts().search(
SearchLoyaltyAccountsRequestLoyaltyAccountQuery
.builder()
.mappings(
- Optional.of(
+ new ArrayList(
Arrays.asList(
LoyaltyAccountMapping
.builder()
@@ -25232,7 +24258,7 @@ Keys can be any valid string, but must be unique for every request.
## Loyalty Programs Promotions
-client.loyalty.programs.promotions.list(programId) -> SyncPagingIterable<LoyaltyPromotion>
+client.loyalty.programs.promotions.list(programId) -> ListLoyaltyPromotionsResponse
-
@@ -25390,7 +24416,9 @@ client.loyalty().programs().promotions().create(
LoyaltyPromotionAvailableTimeData
.builder()
.timePeriods(
- Arrays.asList("BEGIN:VEVENT\nDTSTART:20220816T160000\nDURATION:PT2H\nRRULE:FREQ=WEEKLY;BYDAY=TU\nEND:VEVENT")
+ new ArrayList(
+ Arrays.asList("BEGIN:VEVENT\nDTSTART:20220816T160000\nDURATION:PT2H\nRRULE:FREQ=WEEKLY;BYDAY=TU\nEND:VEVENT")
+ )
)
.build()
)
@@ -25409,7 +24437,7 @@ client.loyalty().programs().promotions().create(
.build()
)
.qualifyingCategoryIds(
- Optional.of(
+ new ArrayList(
Arrays.asList("XTQPYLR3IIU9C44VRCB3XD12")
)
)
@@ -25615,7 +24643,7 @@ promotion that has an `ACTIVE` or `SCHEDULED` status.
## Merchants CustomAttributeDefinitions
-client.merchants.customAttributeDefinitions.list() -> SyncPagingIterable<CustomAttributeDefinition>
+client.merchants.customAttributeDefinitions.list() -> ListMerchantCustomAttributeDefinitionsResponse
-
@@ -26213,7 +25241,7 @@ information needed to create or update a custom attribute.
-client.merchants.customAttributes.list(merchantId) -> SyncPagingIterable<CustomAttribute>
+client.merchants.customAttributes.list(merchantId) -> ListMerchantCustomAttributesResponse
-
@@ -26612,7 +25640,7 @@ definition owner, you must use the qualified key.
## Orders CustomAttributeDefinitions
-client.orders.customAttributeDefinitions.list() -> SyncPagingIterable<CustomAttributeDefinition>
+client.orders.customAttributeDefinitions.list() -> ListOrderCustomAttributeDefinitionsResponse
-
@@ -27214,7 +26242,7 @@ client.orders().customAttributes().batchUpsert(
-client.orders.customAttributes.list(orderId) -> SyncPagingIterable<CustomAttribute>
+client.orders.customAttributes.list(orderId) -> ListOrderCustomAttributesResponse
-
@@ -27728,7 +26756,7 @@ client.teamMembers().wageSetting().update(
WageSetting
.builder()
.jobAssignments(
- Optional.of(
+ new ArrayList(
Arrays.asList(
JobAssignment
.builder()
@@ -28780,7 +27808,7 @@ client.webhooks().eventTypes().list(
## Webhooks Subscriptions
-client.webhooks.subscriptions.list() -> SyncPagingIterable<WebhookSubscription>
+client.webhooks.subscriptions.list() -> ListWebhookSubscriptionsResponse
-
@@ -28918,7 +27946,7 @@ client.webhooks().subscriptions().create(
.builder()
.name("Example Webhook Subscription")
.eventTypes(
- Optional.of(
+ new ArrayList(
Arrays.asList("payment.created", "payment.updated")
)
)
diff --git a/src/main/java/com/squareup/square/AsyncChannelsClient.java b/src/main/java/com/squareup/square/AsyncChannelsClient.java
deleted file mode 100644
index 5d1c9280..00000000
--- a/src/main/java/com/squareup/square/AsyncChannelsClient.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * This file was auto-generated by Fern from our API Definition.
- */
-package com.squareup.square;
-
-import com.squareup.square.core.ClientOptions;
-import com.squareup.square.core.RequestOptions;
-import com.squareup.square.core.SyncPagingIterable;
-import com.squareup.square.types.BulkRetrieveChannelsRequest;
-import com.squareup.square.types.BulkRetrieveChannelsResponse;
-import com.squareup.square.types.Channel;
-import com.squareup.square.types.GetChannelsRequest;
-import com.squareup.square.types.ListChannelsRequest;
-import com.squareup.square.types.RetrieveChannelResponse;
-import java.util.concurrent.CompletableFuture;
-
-public class AsyncChannelsClient {
- protected final ClientOptions clientOptions;
-
- private final AsyncRawChannelsClient rawClient;
-
- public AsyncChannelsClient(ClientOptions clientOptions) {
- this.clientOptions = clientOptions;
- this.rawClient = new AsyncRawChannelsClient(clientOptions);
- }
-
- /**
- * Get responses with HTTP metadata like headers
- */
- public AsyncRawChannelsClient withRawResponse() {
- return this.rawClient;
- }
-
- public CompletableFuture> list() {
- return this.rawClient.list().thenApply(response -> response.body());
- }
-
- public CompletableFuture> list(ListChannelsRequest request) {
- return this.rawClient.list(request).thenApply(response -> response.body());
- }
-
- public CompletableFuture> list(
- ListChannelsRequest request, RequestOptions requestOptions) {
- return this.rawClient.list(request, requestOptions).thenApply(response -> response.body());
- }
-
- public CompletableFuture bulkRetrieve(BulkRetrieveChannelsRequest request) {
- return this.rawClient.bulkRetrieve(request).thenApply(response -> response.body());
- }
-
- public CompletableFuture bulkRetrieve(
- BulkRetrieveChannelsRequest request, RequestOptions requestOptions) {
- return this.rawClient.bulkRetrieve(request, requestOptions).thenApply(response -> response.body());
- }
-
- public CompletableFuture get(GetChannelsRequest request) {
- return this.rawClient.get(request).thenApply(response -> response.body());
- }
-
- public CompletableFuture get(GetChannelsRequest request, RequestOptions requestOptions) {
- return this.rawClient.get(request, requestOptions).thenApply(response -> response.body());
- }
-}
diff --git a/src/main/java/com/squareup/square/AsyncRawApplePayClient.java b/src/main/java/com/squareup/square/AsyncRawApplePayClient.java
index c7e7cf02..dd2daec3 100644
--- a/src/main/java/com/squareup/square/AsyncRawApplePayClient.java
+++ b/src/main/java/com/squareup/square/AsyncRawApplePayClient.java
@@ -93,16 +93,19 @@ public CompletableFuture> regis
@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, RegisterDomainResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBody.string(), RegisterDomainResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
diff --git a/src/main/java/com/squareup/square/AsyncRawBankAccountsClient.java b/src/main/java/com/squareup/square/AsyncRawBankAccountsClient.java
index 94ad3043..f8723ab5 100644
--- a/src/main/java/com/squareup/square/AsyncRawBankAccountsClient.java
+++ b/src/main/java/com/squareup/square/AsyncRawBankAccountsClient.java
@@ -91,10 +91,9 @@ public CompletableFuture startingAfter = parsedResponse.getCursor();
ListBankAccountsRequest nextRequest = ListBankAccountsRequest.builder()
.from(request)
@@ -103,22 +102,24 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
List result =
parsedResponse.getBankAccounts().orElse(Collections.emptyList());
future.complete(new SquareClientHttpResponse<>(
- new SyncPagingIterable(
- startingAfter.isPresent(), result, parsedResponse, () -> {
- try {
- return list(nextRequest, requestOptions)
- .get()
- .body();
- } catch (InterruptedException | ExecutionException e) {
- throw new RuntimeException(e);
- }
- }),
+ new SyncPagingIterable(startingAfter.isPresent(), result, () -> {
+ try {
+ return list(nextRequest, requestOptions)
+ .get()
+ .body();
+ } catch (InterruptedException | ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+ }),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -166,17 +167,19 @@ public CompletableFuture>
@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, GetBankAccountByV1IdResponse.class),
+ responseBody.string(), GetBankAccountByV1IdResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -225,16 +228,19 @@ public CompletableFuture> get(
@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, GetBankAccountResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBody.string(), GetBankAccountResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
diff --git a/src/main/java/com/squareup/square/AsyncRawBookingsClient.java b/src/main/java/com/squareup/square/AsyncRawBookingsClient.java
index 1216b65b..39a41c10 100644
--- a/src/main/java/com/squareup/square/AsyncRawBookingsClient.java
+++ b/src/main/java/com/squareup/square/AsyncRawBookingsClient.java
@@ -128,10 +128,9 @@ public CompletableFuture>>
@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()) {
ListBookingsResponse parsedResponse =
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListBookingsResponse.class);
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListBookingsResponse.class);
Optional startingAfter = parsedResponse.getCursor();
ListBookingsRequest nextRequest = ListBookingsRequest.builder()
.from(request)
@@ -139,22 +138,24 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
.build();
List result = parsedResponse.getBookings().orElse(Collections.emptyList());
future.complete(new SquareClientHttpResponse<>(
- new SyncPagingIterable(
- startingAfter.isPresent(), result, parsedResponse, () -> {
- try {
- return list(nextRequest, requestOptions)
- .get()
- .body();
- } catch (InterruptedException | ExecutionException e) {
- throw new RuntimeException(e);
- }
- }),
+ new SyncPagingIterable(startingAfter.isPresent(), result, () -> {
+ try {
+ return list(nextRequest, requestOptions)
+ .get()
+ .body();
+ } catch (InterruptedException | ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+ }),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -232,16 +233,18 @@ public CompletableFuture> create
@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, CreateBookingResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateBookingResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -300,17 +303,19 @@ public CompletableFuture> s
@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, SearchAvailabilityResponse.class),
+ responseBody.string(), SearchAvailabilityResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -369,17 +374,19 @@ public CompletableFuture>
@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, BulkRetrieveBookingsResponse.class),
+ responseBody.string(), BulkRetrieveBookingsResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -426,17 +433,19 @@ public CompletableFuture(
ObjectMappers.JSON_MAPPER.readValue(
- responseBodyString, GetBusinessBookingProfileResponse.class),
+ responseBody.string(), GetBusinessBookingProfileResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -486,17 +495,19 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) {
@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, RetrieveLocationBookingProfileResponse.class),
+ responseBody.string(), RetrieveLocationBookingProfileResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -553,17 +564,19 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) {
@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, BulkRetrieveTeamMemberBookingProfilesResponse.class),
+ responseBody.string(), BulkRetrieveTeamMemberBookingProfilesResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -614,16 +627,18 @@ public CompletableFuture> get(
@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, GetBookingResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetBookingResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -686,16 +701,18 @@ public CompletableFuture> update
@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, UpdateBookingResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpdateBookingResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -759,16 +776,18 @@ public CompletableFuture> cancel
@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, CancelBookingResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CancelBookingResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
diff --git a/src/main/java/com/squareup/square/AsyncRawCardsClient.java b/src/main/java/com/squareup/square/AsyncRawCardsClient.java
index b4368aad..26d9f3e3 100644
--- a/src/main/java/com/squareup/square/AsyncRawCardsClient.java
+++ b/src/main/java/com/squareup/square/AsyncRawCardsClient.java
@@ -106,10 +106,9 @@ public CompletableFuture>> lis
@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()) {
ListCardsResponse parsedResponse =
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListCardsResponse.class);
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListCardsResponse.class);
Optional startingAfter = parsedResponse.getCursor();
ListCardsRequest nextRequest = ListCardsRequest.builder()
.from(request)
@@ -117,7 +116,7 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
.build();
List result = parsedResponse.getCards().orElse(Collections.emptyList());
future.complete(new SquareClientHttpResponse<>(
- new SyncPagingIterable(startingAfter.isPresent(), result, parsedResponse, () -> {
+ new SyncPagingIterable(startingAfter.isPresent(), result, () -> {
try {
return list(nextRequest, requestOptions)
.get()
@@ -129,9 +128,12 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -185,16 +187,18 @@ public CompletableFuture> create(
@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, CreateCardResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateCardResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -241,16 +245,18 @@ public CompletableFuture> get(
@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, GetCardResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetCardResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -300,16 +306,18 @@ public CompletableFuture> disable(
@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, DisableCardResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DisableCardResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
diff --git a/src/main/java/com/squareup/square/AsyncRawCatalogClient.java b/src/main/java/com/squareup/square/AsyncRawCatalogClient.java
index d65f7705..abf57df2 100644
--- a/src/main/java/com/squareup/square/AsyncRawCatalogClient.java
+++ b/src/main/java/com/squareup/square/AsyncRawCatalogClient.java
@@ -118,17 +118,19 @@ public CompletableFuture(
ObjectMappers.JSON_MAPPER.readValue(
- responseBodyString, BatchDeleteCatalogObjectsResponse.class),
+ responseBody.string(), BatchDeleteCatalogObjectsResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -193,17 +195,19 @@ public CompletableFuture(
ObjectMappers.JSON_MAPPER.readValue(
- responseBodyString, BatchGetCatalogObjectsResponse.class),
+ responseBody.string(), BatchGetCatalogObjectsResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -281,17 +285,19 @@ public CompletableFuture(
ObjectMappers.JSON_MAPPER.readValue(
- responseBodyString, BatchUpsertCatalogObjectsResponse.class),
+ responseBody.string(), BatchUpsertCatalogObjectsResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -338,16 +344,18 @@ public CompletableFuture> info(Req
@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, CatalogInfoResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CatalogInfoResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -428,10 +436,9 @@ public CompletableFuture startingAfter = parsedResponse.getCursor();
ListCatalogRequest nextRequest = ListCatalogRequest.builder()
.from(request)
@@ -439,22 +446,24 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
.build();
List result = parsedResponse.getObjects().orElse(Collections.emptyList());
future.complete(new SquareClientHttpResponse<>(
- new SyncPagingIterable(
- startingAfter.isPresent(), result, parsedResponse, () -> {
- try {
- return list(nextRequest, requestOptions)
- .get()
- .body();
- } catch (InterruptedException | ExecutionException e) {
- throw new RuntimeException(e);
- }
- }),
+ new SyncPagingIterable(startingAfter.isPresent(), result, () -> {
+ try {
+ return list(nextRequest, requestOptions)
+ .get()
+ .body();
+ } catch (InterruptedException | ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+ }),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -543,17 +552,19 @@ public CompletableFuture>
@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, SearchCatalogObjectsResponse.class),
+ responseBody.string(), SearchCatalogObjectsResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -642,17 +653,19 @@ public CompletableFuture> s
@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, SearchCatalogItemsResponse.class),
+ responseBody.string(), SearchCatalogItemsResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -711,17 +724,19 @@ public CompletableFuture(
ObjectMappers.JSON_MAPPER.readValue(
- responseBodyString, UpdateItemModifierListsResponse.class),
+ responseBody.string(), UpdateItemModifierListsResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -780,16 +795,19 @@ public CompletableFuture> upda
@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, UpdateItemTaxesResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBody.string(), UpdateItemTaxesResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
diff --git a/src/main/java/com/squareup/square/AsyncRawChannelsClient.java b/src/main/java/com/squareup/square/AsyncRawChannelsClient.java
deleted file mode 100644
index 9ca8fc0b..00000000
--- a/src/main/java/com/squareup/square/AsyncRawChannelsClient.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/**
- * This file was auto-generated by Fern from our API Definition.
- */
-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;
-import com.squareup.square.core.SquareApiException;
-import com.squareup.square.core.SquareClientHttpResponse;
-import com.squareup.square.core.SquareException;
-import com.squareup.square.core.SyncPagingIterable;
-import com.squareup.square.types.BulkRetrieveChannelsRequest;
-import com.squareup.square.types.BulkRetrieveChannelsResponse;
-import com.squareup.square.types.Channel;
-import com.squareup.square.types.GetChannelsRequest;
-import com.squareup.square.types.ListChannelsRequest;
-import com.squareup.square.types.ListChannelsResponse;
-import com.squareup.square.types.RetrieveChannelResponse;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.List;
-import java.util.Optional;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ExecutionException;
-import okhttp3.Call;
-import okhttp3.Callback;
-import okhttp3.Headers;
-import okhttp3.HttpUrl;
-import okhttp3.OkHttpClient;
-import okhttp3.Request;
-import okhttp3.RequestBody;
-import okhttp3.Response;
-import okhttp3.ResponseBody;
-import org.jetbrains.annotations.NotNull;
-
-public class AsyncRawChannelsClient {
- protected final ClientOptions clientOptions;
-
- public AsyncRawChannelsClient(ClientOptions clientOptions) {
- this.clientOptions = clientOptions;
- }
-
- public CompletableFuture>> list() {
- return list(ListChannelsRequest.builder().build());
- }
-
- public CompletableFuture>> list(ListChannelsRequest request) {
- return list(request, null);
- }
-
- public CompletableFuture>> list(
- ListChannelsRequest request, RequestOptions requestOptions) {
- HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
- .newBuilder()
- .addPathSegments("v2/channels");
- if (request.getReferenceType().isPresent()) {
- QueryStringMapper.addQueryParameter(
- httpUrl, "reference_type", request.getReferenceType().get(), false);
- }
- if (request.getReferenceId().isPresent()) {
- QueryStringMapper.addQueryParameter(
- httpUrl, "reference_id", request.getReferenceId().get(), false);
- }
- if (request.getStatus().isPresent()) {
- QueryStringMapper.addQueryParameter(
- httpUrl, "status", request.getStatus().get(), false);
- }
- if (request.getCursor().isPresent()) {
- QueryStringMapper.addQueryParameter(
- httpUrl, "cursor", request.getCursor().get(), false);
- }
- if (request.getLimit().isPresent()) {
- QueryStringMapper.addQueryParameter(
- httpUrl, "limit", request.getLimit().get(), false);
- }
- Request.Builder _requestBuilder = new Request.Builder()
- .url(httpUrl.build())
- .method("GET", 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()) {
- ListChannelsResponse parsedResponse =
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListChannelsResponse.class);
- Optional startingAfter = parsedResponse.getCursor();
- ListChannelsRequest nextRequest = ListChannelsRequest.builder()
- .from(request)
- .cursor(startingAfter)
- .build();
- List result = parsedResponse.getChannels().orElse(Collections.emptyList());
- future.complete(new SquareClientHttpResponse<>(
- new SyncPagingIterable(
- startingAfter.isPresent(), result, parsedResponse, () -> {
- try {
- return list(nextRequest, requestOptions)
- .get()
- .body();
- } catch (InterruptedException | ExecutionException e) {
- throw new RuntimeException(e);
- }
- }),
- 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;
- }
-
- public CompletableFuture> bulkRetrieve(
- BulkRetrieveChannelsRequest request) {
- return bulkRetrieve(request, null);
- }
-
- public CompletableFuture> bulkRetrieve(
- BulkRetrieveChannelsRequest request, RequestOptions requestOptions) {
- HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
- .newBuilder()
- .addPathSegments("v2/channels/bulk-retrieve")
- .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, BulkRetrieveChannelsResponse.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;
- }
-
- public CompletableFuture> get(GetChannelsRequest request) {
- return get(request, null);
- }
-
- public CompletableFuture> get(
- GetChannelsRequest request, RequestOptions requestOptions) {
- HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
- .newBuilder()
- .addPathSegments("v2/channels")
- .addPathSegment(request.getChannelId())
- .build();
- Request.Builder _requestBuilder = new Request.Builder()
- .url(httpUrl)
- .method("GET", 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, RetrieveChannelResponse.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/AsyncRawCheckoutClient.java b/src/main/java/com/squareup/square/AsyncRawCheckoutClient.java
index ac9c907b..720944b0 100644
--- a/src/main/java/com/squareup/square/AsyncRawCheckoutClient.java
+++ b/src/main/java/com/squareup/square/AsyncRawCheckoutClient.java
@@ -72,17 +72,19 @@ public CompletableFuture(
ObjectMappers.JSON_MAPPER.readValue(
- responseBodyString, RetrieveLocationSettingsResponse.class),
+ responseBody.string(), RetrieveLocationSettingsResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -138,17 +140,19 @@ public CompletableFuture(
ObjectMappers.JSON_MAPPER.readValue(
- responseBodyString, UpdateLocationSettingsResponse.class),
+ responseBody.string(), UpdateLocationSettingsResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -195,17 +199,19 @@ public CompletableFuture(
ObjectMappers.JSON_MAPPER.readValue(
- responseBodyString, RetrieveMerchantSettingsResponse.class),
+ responseBody.string(), RetrieveMerchantSettingsResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -260,17 +266,19 @@ public CompletableFuture(
ObjectMappers.JSON_MAPPER.readValue(
- responseBodyString, UpdateMerchantSettingsResponse.class),
+ responseBody.string(), UpdateMerchantSettingsResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
diff --git a/src/main/java/com/squareup/square/AsyncRawCustomersClient.java b/src/main/java/com/squareup/square/AsyncRawCustomersClient.java
index 13a0b377..f13859f1 100644
--- a/src/main/java/com/squareup/square/AsyncRawCustomersClient.java
+++ b/src/main/java/com/squareup/square/AsyncRawCustomersClient.java
@@ -125,10 +125,9 @@ public CompletableFuture>>
@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()) {
ListCustomersResponse parsedResponse =
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListCustomersResponse.class);
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListCustomersResponse.class);
Optional startingAfter = parsedResponse.getCursor();
ListCustomersRequest nextRequest = ListCustomersRequest.builder()
.from(request)
@@ -136,22 +135,24 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
.build();
List result = parsedResponse.getCustomers().orElse(Collections.emptyList());
future.complete(new SquareClientHttpResponse<>(
- new SyncPagingIterable(
- startingAfter.isPresent(), result, parsedResponse, () -> {
- try {
- return list(nextRequest, requestOptions)
- .get()
- .body();
- } catch (InterruptedException | ExecutionException e) {
- throw new RuntimeException(e);
- }
- }),
+ new SyncPagingIterable(startingAfter.isPresent(), result, () -> {
+ try {
+ return list(nextRequest, requestOptions)
+ .get()
+ .body();
+ } catch (InterruptedException | ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+ }),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -239,16 +240,19 @@ public CompletableFuture> creat
@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, CreateCustomerResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBody.string(), CreateCustomerResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -321,17 +325,19 @@ public CompletableFuture>
@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, BulkCreateCustomersResponse.class),
+ responseBody.string(), BulkCreateCustomersResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -388,17 +394,19 @@ public CompletableFuture>
@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, BulkDeleteCustomersResponse.class),
+ responseBody.string(), BulkDeleteCustomersResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -455,17 +463,19 @@ public CompletableFuture
@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, BulkRetrieveCustomersResponse.class),
+ responseBody.string(), BulkRetrieveCustomersResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -522,17 +532,19 @@ public CompletableFuture>
@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, BulkUpdateCustomersResponse.class),
+ responseBody.string(), BulkUpdateCustomersResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -611,16 +623,19 @@ public CompletableFuture> sear
@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, SearchCustomersResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBody.string(), SearchCustomersResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -667,16 +682,18 @@ public CompletableFuture> get(
@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, GetCustomerResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetCustomerResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -735,16 +752,19 @@ public CompletableFuture> updat
@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, UpdateCustomerResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBody.string(), UpdateCustomerResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -796,16 +816,19 @@ public CompletableFuture> delet
@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, DeleteCustomerResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBody.string(), DeleteCustomerResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
diff --git a/src/main/java/com/squareup/square/AsyncRawDevicesClient.java b/src/main/java/com/squareup/square/AsyncRawDevicesClient.java
index fbf38cb8..6d201134 100644
--- a/src/main/java/com/squareup/square/AsyncRawDevicesClient.java
+++ b/src/main/java/com/squareup/square/AsyncRawDevicesClient.java
@@ -95,10 +95,9 @@ public CompletableFuture>> l
@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()) {
ListDevicesResponse parsedResponse =
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListDevicesResponse.class);
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListDevicesResponse.class);
Optional startingAfter = parsedResponse.getCursor();
ListDevicesRequest nextRequest = ListDevicesRequest.builder()
.from(request)
@@ -106,22 +105,24 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
.build();
List result = parsedResponse.getDevices().orElse(Collections.emptyList());
future.complete(new SquareClientHttpResponse<>(
- new SyncPagingIterable(
- startingAfter.isPresent(), result, parsedResponse, () -> {
- try {
- return list(nextRequest, requestOptions)
- .get()
- .body();
- } catch (InterruptedException | ExecutionException e) {
- throw new RuntimeException(e);
- }
- }),
+ new SyncPagingIterable(startingAfter.isPresent(), result, () -> {
+ try {
+ return list(nextRequest, requestOptions)
+ .get()
+ .body();
+ } catch (InterruptedException | ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+ }),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -168,16 +169,18 @@ public CompletableFuture> get(
@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, GetDeviceResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetDeviceResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
diff --git a/src/main/java/com/squareup/square/AsyncRawDisputesClient.java b/src/main/java/com/squareup/square/AsyncRawDisputesClient.java
index c6a8e53d..e38fe116 100644
--- a/src/main/java/com/squareup/square/AsyncRawDisputesClient.java
+++ b/src/main/java/com/squareup/square/AsyncRawDisputesClient.java
@@ -102,10 +102,9 @@ public CompletableFuture>>
@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()) {
ListDisputesResponse parsedResponse =
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListDisputesResponse.class);
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListDisputesResponse.class);
Optional startingAfter = parsedResponse.getCursor();
ListDisputesRequest nextRequest = ListDisputesRequest.builder()
.from(request)
@@ -113,22 +112,24 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
.build();
List result = parsedResponse.getDisputes().orElse(Collections.emptyList());
future.complete(new SquareClientHttpResponse<>(
- new SyncPagingIterable(
- startingAfter.isPresent(), result, parsedResponse, () -> {
- try {
- return list(nextRequest, requestOptions)
- .get()
- .body();
- } catch (InterruptedException | ExecutionException e) {
- throw new RuntimeException(e);
- }
- }),
+ new SyncPagingIterable(startingAfter.isPresent(), result, () -> {
+ try {
+ return list(nextRequest, requestOptions)
+ .get()
+ .body();
+ } catch (InterruptedException | ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+ }),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -175,16 +176,18 @@ public CompletableFuture> get(
@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, GetDisputeResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetDisputeResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -238,16 +241,18 @@ public CompletableFuture> accept
@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, AcceptDisputeResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), AcceptDisputeResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -283,10 +288,10 @@ public CompletableFuture(
ObjectMappers.JSON_MAPPER.readValue(
- responseBodyString, CreateDisputeEvidenceFileResponse.class),
+ responseBody.string(), CreateDisputeEvidenceFileResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -388,17 +395,19 @@ public CompletableFuture(
ObjectMappers.JSON_MAPPER.readValue(
- responseBodyString, CreateDisputeEvidenceTextResponse.class),
+ responseBody.string(), CreateDisputeEvidenceTextResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -457,16 +466,19 @@ public CompletableFuture> submi
@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, SubmitEvidenceResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBody.string(), SubmitEvidenceResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
diff --git a/src/main/java/com/squareup/square/AsyncRawEmployeesClient.java b/src/main/java/com/squareup/square/AsyncRawEmployeesClient.java
index 43f269f1..8f1ea66a 100644
--- a/src/main/java/com/squareup/square/AsyncRawEmployeesClient.java
+++ b/src/main/java/com/squareup/square/AsyncRawEmployeesClient.java
@@ -84,10 +84,9 @@ public CompletableFuture>>
@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()) {
ListEmployeesResponse parsedResponse =
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListEmployeesResponse.class);
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListEmployeesResponse.class);
Optional startingAfter = parsedResponse.getCursor();
ListEmployeesRequest nextRequest = ListEmployeesRequest.builder()
.from(request)
@@ -95,22 +94,24 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
.build();
List result = parsedResponse.getEmployees().orElse(Collections.emptyList());
future.complete(new SquareClientHttpResponse<>(
- new SyncPagingIterable(
- startingAfter.isPresent(), result, parsedResponse, () -> {
- try {
- return list(nextRequest, requestOptions)
- .get()
- .body();
- } catch (InterruptedException | ExecutionException e) {
- throw new RuntimeException(e);
- }
- }),
+ new SyncPagingIterable(startingAfter.isPresent(), result, () -> {
+ try {
+ return list(nextRequest, requestOptions)
+ .get()
+ .body();
+ } catch (InterruptedException | ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+ }),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -151,16 +152,18 @@ public CompletableFuture> get(
@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, GetEmployeeResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetEmployeeResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
diff --git a/src/main/java/com/squareup/square/AsyncRawEventsClient.java b/src/main/java/com/squareup/square/AsyncRawEventsClient.java
index dd4c3eb6..c6b880b8 100644
--- a/src/main/java/com/squareup/square/AsyncRawEventsClient.java
+++ b/src/main/java/com/squareup/square/AsyncRawEventsClient.java
@@ -84,16 +84,18 @@ public CompletableFuture> searchE
@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, SearchEventsResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), SearchEventsResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -143,16 +145,18 @@ public CompletableFuture> disabl
@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, DisableEventsResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DisableEventsResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -198,16 +202,18 @@ public CompletableFuture> enableE
@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, EnableEventsResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), EnableEventsResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -264,16 +270,19 @@ public CompletableFuture> listE
@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, ListEventTypesResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBody.string(), ListEventTypesResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
diff --git a/src/main/java/com/squareup/square/AsyncRawGiftCardsClient.java b/src/main/java/com/squareup/square/AsyncRawGiftCardsClient.java
index 00ae0015..bf91dda6 100644
--- a/src/main/java/com/squareup/square/AsyncRawGiftCardsClient.java
+++ b/src/main/java/com/squareup/square/AsyncRawGiftCardsClient.java
@@ -113,10 +113,9 @@ public CompletableFuture>>
@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()) {
ListGiftCardsResponse parsedResponse =
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListGiftCardsResponse.class);
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListGiftCardsResponse.class);
Optional startingAfter = parsedResponse.getCursor();
ListGiftCardsRequest nextRequest = ListGiftCardsRequest.builder()
.from(request)
@@ -124,22 +123,24 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
.build();
List result = parsedResponse.getGiftCards().orElse(Collections.emptyList());
future.complete(new SquareClientHttpResponse<>(
- new SyncPagingIterable(
- startingAfter.isPresent(), result, parsedResponse, () -> {
- try {
- return list(nextRequest, requestOptions)
- .get()
- .body();
- } catch (InterruptedException | ExecutionException e) {
- throw new RuntimeException(e);
- }
- }),
+ new SyncPagingIterable(startingAfter.isPresent(), result, () -> {
+ try {
+ return list(nextRequest, requestOptions)
+ .get()
+ .body();
+ } catch (InterruptedException | ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+ }),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -201,16 +202,19 @@ public CompletableFuture> creat
@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, CreateGiftCardResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBody.string(), CreateGiftCardResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -265,17 +269,19 @@ public CompletableFuture> g
@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, GetGiftCardFromGanResponse.class),
+ responseBody.string(), GetGiftCardFromGanResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -330,17 +336,19 @@ public CompletableFuture>
@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, GetGiftCardFromNonceResponse.class),
+ responseBody.string(), GetGiftCardFromNonceResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -397,17 +405,19 @@ public CompletableFuture(
ObjectMappers.JSON_MAPPER.readValue(
- responseBodyString, LinkCustomerToGiftCardResponse.class),
+ responseBody.string(), LinkCustomerToGiftCardResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -465,17 +475,19 @@ public CompletableFuture(
ObjectMappers.JSON_MAPPER.readValue(
- responseBodyString, UnlinkCustomerFromGiftCardResponse.class),
+ responseBody.string(), UnlinkCustomerFromGiftCardResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -522,16 +534,18 @@ public CompletableFuture> get(
@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, GetGiftCardResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetGiftCardResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
diff --git a/src/main/java/com/squareup/square/AsyncRawInventoryClient.java b/src/main/java/com/squareup/square/AsyncRawInventoryClient.java
index 6de8d935..44379820 100644
--- a/src/main/java/com/squareup/square/AsyncRawInventoryClient.java
+++ b/src/main/java/com/squareup/square/AsyncRawInventoryClient.java
@@ -92,17 +92,19 @@ public CompletableFuture(
ObjectMappers.JSON_MAPPER.readValue(
- responseBodyString, GetInventoryAdjustmentResponse.class),
+ responseBody.string(), GetInventoryAdjustmentResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -152,17 +154,19 @@ public CompletableFuture(
ObjectMappers.JSON_MAPPER.readValue(
- responseBodyString, GetInventoryAdjustmentResponse.class),
+ responseBody.string(), GetInventoryAdjustmentResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -219,17 +223,19 @@ public CompletableFuture>
@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, BatchChangeInventoryResponse.class),
+ responseBody.string(), BatchChangeInventoryResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -296,17 +302,19 @@ public CompletableFuture(
ObjectMappers.JSON_MAPPER.readValue(
- responseBodyString, BatchGetInventoryChangesResponse.class),
+ responseBody.string(), BatchGetInventoryChangesResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -371,17 +379,19 @@ public CompletableFuture(
ObjectMappers.JSON_MAPPER.readValue(
- responseBodyString, BatchGetInventoryCountsResponse.class),
+ responseBody.string(), BatchGetInventoryCountsResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -442,17 +452,19 @@ public CompletableFuture>
@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, BatchChangeInventoryResponse.class),
+ responseBody.string(), BatchChangeInventoryResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -530,10 +542,9 @@ public CompletableFuture startingAfter = parsedResponse.getCursor();
BatchRetrieveInventoryChangesRequest nextRequest =
BatchRetrieveInventoryChangesRequest.builder()
@@ -543,22 +554,24 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
List result =
parsedResponse.getChanges().orElse(Collections.emptyList());
future.complete(new SquareClientHttpResponse<>(
- new SyncPagingIterable(
- startingAfter.isPresent(), result, parsedResponse, () -> {
- try {
- return batchGetChanges(nextRequest, requestOptions)
- .get()
- .body();
- } catch (InterruptedException | ExecutionException e) {
- throw new RuntimeException(e);
- }
- }),
+ new SyncPagingIterable(startingAfter.isPresent(), result, () -> {
+ try {
+ return batchGetChanges(nextRequest, requestOptions)
+ .get()
+ .body();
+ } catch (InterruptedException | ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+ }),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -645,10 +658,9 @@ public CompletableFuture startingAfter = parsedResponse.getCursor();
BatchGetInventoryCountsRequest nextRequest = BatchGetInventoryCountsRequest.builder()
.from(request)
@@ -656,22 +668,24 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
.build();
List result = parsedResponse.getCounts().orElse(Collections.emptyList());
future.complete(new SquareClientHttpResponse<>(
- new SyncPagingIterable(
- startingAfter.isPresent(), result, parsedResponse, () -> {
- try {
- return batchGetCounts(nextRequest, requestOptions)
- .get()
- .body();
- } catch (InterruptedException | ExecutionException e) {
- throw new RuntimeException(e);
- }
- }),
+ new SyncPagingIterable(startingAfter.isPresent(), result, () -> {
+ try {
+ return batchGetCounts(nextRequest, requestOptions)
+ .get()
+ .body();
+ } catch (InterruptedException | ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+ }),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -722,17 +736,19 @@ public CompletableFuture(
ObjectMappers.JSON_MAPPER.readValue(
- responseBodyString, GetInventoryPhysicalCountResponse.class),
+ responseBody.string(), GetInventoryPhysicalCountResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -783,17 +799,19 @@ public CompletableFuture(
ObjectMappers.JSON_MAPPER.readValue(
- responseBodyString, GetInventoryPhysicalCountResponse.class),
+ responseBody.string(), GetInventoryPhysicalCountResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -843,17 +861,19 @@ public CompletableFuture>
@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, GetInventoryTransferResponse.class),
+ responseBody.string(), GetInventoryTransferResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -915,10 +935,9 @@ public CompletableFuture startingAfter = parsedResponse.getCursor();
GetInventoryRequest nextRequest = GetInventoryRequest.builder()
.from(request)
@@ -926,22 +945,24 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
.build();
List result = parsedResponse.getCounts().orElse(Collections.emptyList());
future.complete(new SquareClientHttpResponse<>(
- new SyncPagingIterable(
- startingAfter.isPresent(), result, parsedResponse, () -> {
- try {
- return get(nextRequest, requestOptions)
- .get()
- .body();
- } catch (InterruptedException | ExecutionException e) {
- throw new RuntimeException(e);
- }
- }),
+ new SyncPagingIterable(startingAfter.isPresent(), result, () -> {
+ try {
+ return get(nextRequest, requestOptions)
+ .get()
+ .body();
+ } catch (InterruptedException | ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+ }),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -1016,10 +1037,9 @@ public CompletableFuture startingAfter = parsedResponse.getCursor();
ChangesInventoryRequest nextRequest = ChangesInventoryRequest.builder()
.from(request)
@@ -1028,22 +1048,24 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
List result =
parsedResponse.getChanges().orElse(Collections.emptyList());
future.complete(new SquareClientHttpResponse<>(
- new SyncPagingIterable(
- startingAfter.isPresent(), result, parsedResponse, () -> {
- try {
- return changes(nextRequest, requestOptions)
- .get()
- .body();
- } catch (InterruptedException | ExecutionException e) {
- throw new RuntimeException(e);
- }
- }),
+ new SyncPagingIterable(startingAfter.isPresent(), result, () -> {
+ try {
+ return changes(nextRequest, requestOptions)
+ .get()
+ .body();
+ } catch (InterruptedException | ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+ }),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
diff --git a/src/main/java/com/squareup/square/AsyncRawInvoicesClient.java b/src/main/java/com/squareup/square/AsyncRawInvoicesClient.java
index ef2153a8..68b3c5ad 100644
--- a/src/main/java/com/squareup/square/AsyncRawInvoicesClient.java
+++ b/src/main/java/com/squareup/square/AsyncRawInvoicesClient.java
@@ -104,10 +104,9 @@ public CompletableFuture>>
@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()) {
ListInvoicesResponse parsedResponse =
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListInvoicesResponse.class);
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListInvoicesResponse.class);
Optional startingAfter = parsedResponse.getCursor();
ListInvoicesRequest nextRequest = ListInvoicesRequest.builder()
.from(request)
@@ -115,22 +114,24 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
.build();
List result = parsedResponse.getInvoices().orElse(Collections.emptyList());
future.complete(new SquareClientHttpResponse<>(
- new SyncPagingIterable(
- startingAfter.isPresent(), result, parsedResponse, () -> {
- try {
- return list(nextRequest, requestOptions)
- .get()
- .body();
- } catch (InterruptedException | ExecutionException e) {
- throw new RuntimeException(e);
- }
- }),
+ new SyncPagingIterable(startingAfter.isPresent(), result, () -> {
+ try {
+ return list(nextRequest, requestOptions)
+ .get()
+ .body();
+ } catch (InterruptedException | ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+ }),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -190,16 +191,18 @@ public CompletableFuture> create
@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, CreateInvoiceResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateInvoiceResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -263,16 +266,19 @@ public CompletableFuture> searc
@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, SearchInvoicesResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBody.string(), SearchInvoicesResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -319,16 +325,18 @@ public CompletableFuture> get(
@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, GetInvoiceResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetInvoiceResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -389,16 +397,18 @@ public CompletableFuture> update
@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, UpdateInvoiceResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpdateInvoiceResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -452,16 +462,18 @@ public CompletableFuture> delete
@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, DeleteInvoiceResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeleteInvoiceResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -505,10 +517,10 @@ public CompletableFuture(
ObjectMappers.JSON_MAPPER.readValue(
- responseBodyString, CreateInvoiceAttachmentResponse.class),
+ responseBody.string(), CreateInvoiceAttachmentResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -603,17 +617,19 @@ public CompletableFuture(
ObjectMappers.JSON_MAPPER.readValue(
- responseBodyString, DeleteInvoiceAttachmentResponse.class),
+ responseBody.string(), DeleteInvoiceAttachmentResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -673,16 +689,18 @@ public CompletableFuture> cancel
@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, CancelInvoiceResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CancelInvoiceResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -758,16 +776,19 @@ public CompletableFuture> publi
@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, PublishInvoiceResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBody.string(), PublishInvoiceResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
diff --git a/src/main/java/com/squareup/square/AsyncRawLaborClient.java b/src/main/java/com/squareup/square/AsyncRawLaborClient.java
index 83fe68d1..8e7656bb 100644
--- a/src/main/java/com/squareup/square/AsyncRawLaborClient.java
+++ b/src/main/java/com/squareup/square/AsyncRawLaborClient.java
@@ -109,17 +109,19 @@ public CompletableFuture>
@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, CreateScheduledShiftResponse.class),
+ responseBody.string(), CreateScheduledShiftResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -183,17 +185,19 @@ public CompletableFuture(
ObjectMappers.JSON_MAPPER.readValue(
- responseBodyString, BulkPublishScheduledShiftsResponse.class),
+ responseBody.string(), BulkPublishScheduledShiftsResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -258,17 +262,19 @@ public CompletableFuture
@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, SearchScheduledShiftsResponse.class),
+ responseBody.string(), SearchScheduledShiftsResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -316,17 +322,19 @@ public CompletableFuture(
ObjectMappers.JSON_MAPPER.readValue(
- responseBodyString, RetrieveScheduledShiftResponse.class),
+ responseBody.string(), RetrieveScheduledShiftResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -402,17 +410,19 @@ public CompletableFuture>
@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, UpdateScheduledShiftResponse.class),
+ responseBody.string(), UpdateScheduledShiftResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -471,17 +481,19 @@ public CompletableFuture
@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, PublishScheduledShiftResponse.class),
+ responseBody.string(), PublishScheduledShiftResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -572,16 +584,19 @@ public CompletableFuture> creat
@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, CreateTimecardResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBody.string(), CreateTimecardResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -691,16 +706,19 @@ public CompletableFuture> sear
@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, SearchTimecardsResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBody.string(), SearchTimecardsResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -748,16 +766,19 @@ public CompletableFuture> ret
@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, RetrieveTimecardResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBody.string(), RetrieveTimecardResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -821,16 +842,19 @@ public CompletableFuture> updat
@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, UpdateTimecardResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBody.string(), UpdateTimecardResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -878,16 +902,19 @@ public CompletableFuture> delet
@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, DeleteTimecardResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBody.string(), DeleteTimecardResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
diff --git a/src/main/java/com/squareup/square/AsyncRawLocationsClient.java b/src/main/java/com/squareup/square/AsyncRawLocationsClient.java
index 553bd8b3..879beddd 100644
--- a/src/main/java/com/squareup/square/AsyncRawLocationsClient.java
+++ b/src/main/java/com/squareup/square/AsyncRawLocationsClient.java
@@ -72,16 +72,18 @@ public CompletableFuture> list(R
@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, ListLocationsResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListLocationsResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -160,16 +162,19 @@ public CompletableFuture> creat
@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, CreateLocationResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBody.string(), CreateLocationResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -218,16 +223,18 @@ public CompletableFuture> get(
@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, GetLocationResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetLocationResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -282,16 +289,19 @@ public CompletableFuture> updat
@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, UpdateLocationResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBody.string(), UpdateLocationResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -356,16 +366,19 @@ public CompletableFuture> check
@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, CreateCheckoutResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBody.string(), CreateCheckoutResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
diff --git a/src/main/java/com/squareup/square/AsyncRawLoyaltyClient.java b/src/main/java/com/squareup/square/AsyncRawLoyaltyClient.java
index aa31a3d1..2540f6f8 100644
--- a/src/main/java/com/squareup/square/AsyncRawLoyaltyClient.java
+++ b/src/main/java/com/squareup/square/AsyncRawLoyaltyClient.java
@@ -95,17 +95,19 @@ public CompletableFuture>
@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, SearchLoyaltyEventsResponse.class),
+ responseBody.string(), SearchLoyaltyEventsResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
diff --git a/src/main/java/com/squareup/square/AsyncRawMerchantsClient.java b/src/main/java/com/squareup/square/AsyncRawMerchantsClient.java
index 7683af5d..aede5fe7 100644
--- a/src/main/java/com/squareup/square/AsyncRawMerchantsClient.java
+++ b/src/main/java/com/squareup/square/AsyncRawMerchantsClient.java
@@ -102,10 +102,9 @@ public CompletableFuture>>
@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()) {
ListMerchantsResponse parsedResponse =
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListMerchantsResponse.class);
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListMerchantsResponse.class);
Optional startingAfter = parsedResponse.getCursor();
ListMerchantsRequest nextRequest = ListMerchantsRequest.builder()
.from(request)
@@ -113,22 +112,24 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
.build();
List result = parsedResponse.getMerchant().orElse(Collections.emptyList());
future.complete(new SquareClientHttpResponse<>(
- new SyncPagingIterable(
- startingAfter.isPresent(), result, parsedResponse, () -> {
- try {
- return list(nextRequest, requestOptions)
- .get()
- .body();
- } catch (InterruptedException | ExecutionException e) {
- throw new RuntimeException(e);
- }
- }),
+ new SyncPagingIterable(startingAfter.isPresent(), result, () -> {
+ try {
+ return list(nextRequest, requestOptions)
+ .get()
+ .body();
+ } catch (InterruptedException | ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+ }),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -175,16 +176,18 @@ public CompletableFuture> get(
@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, GetMerchantResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetMerchantResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
diff --git a/src/main/java/com/squareup/square/AsyncRawMobileClient.java b/src/main/java/com/squareup/square/AsyncRawMobileClient.java
index c6a5831b..aa10140d 100644
--- a/src/main/java/com/squareup/square/AsyncRawMobileClient.java
+++ b/src/main/java/com/squareup/square/AsyncRawMobileClient.java
@@ -105,17 +105,19 @@ public CompletableFuture(
ObjectMappers.JSON_MAPPER.readValue(
- responseBodyString, CreateMobileAuthorizationCodeResponse.class),
+ responseBody.string(), CreateMobileAuthorizationCodeResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
diff --git a/src/main/java/com/squareup/square/AsyncRawOAuthClient.java b/src/main/java/com/squareup/square/AsyncRawOAuthClient.java
index f05fe7e6..9d545ecd 100644
--- a/src/main/java/com/squareup/square/AsyncRawOAuthClient.java
+++ b/src/main/java/com/squareup/square/AsyncRawOAuthClient.java
@@ -106,16 +106,18 @@ public CompletableFuture> revokeTo
@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, RevokeTokenResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), RevokeTokenResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -209,16 +211,18 @@ public CompletableFuture> obtainTo
@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, ObtainTokenResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ObtainTokenResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -278,17 +282,19 @@ public CompletableFuture>
@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, RetrieveTokenStatusResponse.class),
+ responseBody.string(), RetrieveTokenStatusResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -331,9 +337,11 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
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));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
diff --git a/src/main/java/com/squareup/square/AsyncRawOrdersClient.java b/src/main/java/com/squareup/square/AsyncRawOrdersClient.java
index 990b8541..e0c695c7 100644
--- a/src/main/java/com/squareup/square/AsyncRawOrdersClient.java
+++ b/src/main/java/com/squareup/square/AsyncRawOrdersClient.java
@@ -105,16 +105,18 @@ public CompletableFuture> create(
@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, CreateOrderResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateOrderResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -170,16 +172,19 @@ public CompletableFuture> batch
@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, BatchGetOrdersResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBody.string(), BatchGetOrdersResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -234,16 +239,19 @@ public CompletableFuture> calcu
@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, CalculateOrderResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBody.string(), CalculateOrderResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -299,16 +307,18 @@ public CompletableFuture> clone(
@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, CloneOrderResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CloneOrderResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -408,16 +418,18 @@ public CompletableFuture> search(
@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, SearchOrdersResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), SearchOrdersResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -464,16 +476,18 @@ public CompletableFuture> get(
@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, GetOrderResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetOrderResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -554,16 +568,18 @@ public CompletableFuture> update(
@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, UpdateOrderResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpdateOrderResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -643,16 +659,18 @@ public CompletableFuture> pay(
@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, PayOrderResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), PayOrderResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
diff --git a/src/main/java/com/squareup/square/AsyncRawPaymentsClient.java b/src/main/java/com/squareup/square/AsyncRawPaymentsClient.java
index 7b191908..020f5c14 100644
--- a/src/main/java/com/squareup/square/AsyncRawPaymentsClient.java
+++ b/src/main/java/com/squareup/square/AsyncRawPaymentsClient.java
@@ -164,10 +164,9 @@ public CompletableFuture>>
@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()) {
ListPaymentsResponse parsedResponse =
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPaymentsResponse.class);
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListPaymentsResponse.class);
Optional startingAfter = parsedResponse.getCursor();
ListPaymentsRequest nextRequest = ListPaymentsRequest.builder()
.from(request)
@@ -175,22 +174,24 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
.build();
List result = parsedResponse.getPayments().orElse(Collections.emptyList());
future.complete(new SquareClientHttpResponse<>(
- new SyncPagingIterable(
- startingAfter.isPresent(), result, parsedResponse, () -> {
- try {
- return list(nextRequest, requestOptions)
- .get()
- .body();
- } catch (InterruptedException | ExecutionException e) {
- throw new RuntimeException(e);
- }
- }),
+ new SyncPagingIterable(startingAfter.isPresent(), result, () -> {
+ try {
+ return list(nextRequest, requestOptions)
+ .get()
+ .body();
+ } catch (InterruptedException | ExecutionException e) {
+ throw new RuntimeException(e);
+ }
+ }),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -256,16 +257,18 @@ public CompletableFuture> create
@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, CreatePaymentResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreatePaymentResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -337,17 +340,19 @@ public CompletableFuture(
ObjectMappers.JSON_MAPPER.readValue(
- responseBodyString, CancelPaymentByIdempotencyKeyResponse.class),
+ responseBody.string(), CancelPaymentByIdempotencyKeyResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -394,16 +399,18 @@ public CompletableFuture> get(
@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, GetPaymentResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetPaymentResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -460,16 +467,18 @@ public CompletableFuture> update
@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, UpdatePaymentResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), UpdatePaymentResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -519,16 +528,18 @@ public CompletableFuture> cancel
@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, CancelPaymentResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CancelPaymentResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
@@ -589,16 +600,19 @@ public CompletableFuture> comp
@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, CompletePaymentResponse.class),
+ ObjectMappers.JSON_MAPPER.readValue(
+ responseBody.string(), CompletePaymentResponse.class),
response));
return;
}
- Object errorBody = ObjectMappers.parseErrorBody(responseBodyString);
+ String responseBodyString = responseBody != null ? responseBody.string() : "{}";
future.completeExceptionally(new SquareApiException(
- "Error with status code " + response.code(), response.code(), errorBody, response));
+ "Error with status code " + response.code(),
+ response.code(),
+ ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
+ response));
return;
} catch (IOException e) {
future.completeExceptionally(new SquareException("Network error executing HTTP request", e));
diff --git a/src/main/java/com/squareup/square/AsyncRawPayoutsClient.java b/src/main/java/com/squareup/square/AsyncRawPayoutsClient.java
index ff14e1d8..e0606eba 100644
--- a/src/main/java/com/squareup/square/AsyncRawPayoutsClient.java
+++ b/src/main/java/com/squareup/square/AsyncRawPayoutsClient.java
@@ -113,10 +113,9 @@ public CompletableFuture>> l
@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()) {
ListPayoutsResponse parsedResponse =
- ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListPayoutsResponse.class);
+ ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListPayoutsResponse.class);
Optional startingAfter = parsedResponse.getCursor();
ListPayoutsRequest nextRequest = ListPayoutsRequest.builder()
.from(request)
@@ -124,22 +123,24 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
.build();
List result = parsedResponse.getPayouts().orElse(Collections.emptyList());
future.complete(new SquareClientHttpResponse<>(
- new SyncPagingIterable