From 598fdcb12665f2845edd9f1a5f4582ac392fe398 Mon Sep 17 00:00:00 2001 From: autobot Date: Wed, 7 Jun 2023 17:29:30 +0000 Subject: [PATCH] Generated PR for Release: 28.0.0 --- doc/api/apple-pay.md | 3 +- doc/api/bank-accounts.md | 8 +- doc/api/booking-custom-attributes.md | 98 ++-- doc/api/bookings.md | 63 ++- doc/api/cards.md | 44 +- doc/api/cash-drawers.md | 21 +- doc/api/catalog.md | 524 +++++++++--------- doc/api/checkout.md | 273 ++++----- doc/api/customer-custom-attributes.md | 97 ++-- doc/api/customer-groups.md | 34 +- doc/api/customer-segments.md | 5 +- doc/api/customers.md | 181 +++--- doc/api/devices.md | 20 +- doc/api/disputes.md | 46 +- doc/api/employees.md | 5 +- doc/api/gift-card-activities.md | 26 +- doc/api/gift-cards.md | 40 +- doc/api/inventory.md | 191 ++++--- doc/api/invoices.md | 211 ++++--- doc/api/labor.md | 247 ++++----- doc/api/location-custom-attributes.md | 107 ++-- doc/api/locations.md | 96 ++-- doc/api/loyalty.md | 254 ++++----- doc/api/merchant-custom-attributes.md | 106 ++-- doc/api/merchants.md | 5 +- doc/api/mobile-authorization.md | 8 +- doc/api/o-auth.md | 52 +- doc/api/order-custom-attributes.md | 118 ++-- doc/api/orders.md | 327 +++++------ doc/api/payments.md | 83 +-- doc/api/payouts.md | 8 +- doc/api/refunds.md | 30 +- doc/api/sites.md | 2 +- doc/api/snippets.md | 21 +- doc/api/subscriptions.md | 153 ++--- doc/api/team.md | 246 ++++---- doc/api/terminal.md | 215 +++---- doc/api/transactions.md | 30 +- doc/api/v1-transactions.md | 65 ++- doc/api/vendors.md | 66 ++- doc/api/webhook-subscriptions.md | 84 +-- doc/client.md | 10 +- doc/models/activity-type.md | 4 + doc/models/cancel-subscription-response.md | 53 +- .../cancel-terminal-checkout-response.md | 2 +- .../catalog-custom-attribute-definition.md | 6 +- doc/models/catalog-item-option.md | 6 +- doc/models/catalog-modifier-list.md | 4 +- doc/models/catalog-object-batch.md | 2 +- doc/models/catalog-object-type.md | 1 + doc/models/catalog-object.md | 4 +- .../catalog-subscription-plan-variation.md | 51 ++ doc/models/catalog-subscription-plan.md | 101 +++- doc/models/checkout-options.md | 2 + doc/models/collected-data.md | 21 + doc/models/confirmation-decision.md | 21 + doc/models/confirmation-options.md | 31 ++ ...eate-mobile-authorization-code-response.md | 28 +- doc/models/create-payment-link-response.md | 6 +- doc/models/create-subscription-request.md | 13 +- doc/models/create-subscription-response.md | 5 +- .../create-terminal-checkout-response.md | 2 +- .../data-collection-options-input-type.md | 16 + doc/models/data-collection-options.md | 29 + .../delete-subscription-action-response.md | 5 +- .../dismiss-terminal-action-response.md | 63 +++ doc/models/employee-wage.md | 3 +- doc/models/get-employee-wage-response.md | 2 +- doc/models/get-team-member-wage-response.md | 3 +- doc/models/get-terminal-checkout-response.md | 2 +- doc/models/list-payouts-response.md | 2 + .../list-subscription-events-request.md | 2 +- .../list-subscription-events-response.md | 120 ++-- doc/models/list-team-member-wages-response.md | 12 +- doc/models/obtain-token-request.md | 8 +- doc/models/pause-subscription-response.md | 13 +- doc/models/payment-link-related-resources.md | 4 +- doc/models/payout.md | 1 + doc/models/phase-input.md | 25 + doc/models/phase.md | 29 + doc/models/qr-code-options.md | 27 + doc/models/resume-subscription-response.md | 13 +- doc/models/retrieve-subscription-response.md | 5 +- doc/models/retrieve-token-status-response.md | 4 +- doc/models/revoke-token-request.md | 2 +- doc/models/search-catalog-items-response.md | 4 +- doc/models/search-catalog-objects-response.md | 6 +- doc/models/search-subscriptions-request.md | 2 +- doc/models/search-subscriptions-response.md | 11 +- doc/models/search-terminal-actions-request.md | 2 +- .../search-terminal-checkouts-response.md | 4 +- doc/models/select-option.md | 23 + doc/models/select-options.md | 35 ++ doc/models/shift-wage.md | 6 +- doc/models/signature-image.md | 23 + doc/models/signature-options.md | 30 + doc/models/subscription-action.md | 19 +- doc/models/subscription-event.md | 21 +- doc/models/subscription-phase.md | 17 +- doc/models/subscription-pricing-type.md | 16 + doc/models/subscription-pricing.md | 33 ++ doc/models/subscription.md | 11 +- doc/models/swap-plan-request.md | 15 +- doc/models/swap-plan-response.md | 24 +- doc/models/team-member-wage.md | 4 +- doc/models/terminal-action-action-type.md | 5 + doc/models/terminal-action-query-filter.md | 2 +- doc/models/terminal-action-query.md | 2 +- doc/models/terminal-action.md | 7 + doc/models/update-subscription-request.md | 4 +- doc/models/update-subscription-response.md | 3 +- package.json | 4 +- src/api/oAuthApi.ts | 12 +- src/api/subscriptionsApi.ts | 32 +- src/api/terminalApi.ts | 27 +- src/client.ts | 4 +- src/defaultConfiguration.ts | 2 +- src/index.ts | 14 + src/models/cancelSubscriptionResponse.ts | 6 +- .../catalogCustomAttributeDefinition.ts | 5 +- src/models/catalogObject.ts | 19 +- src/models/catalogQuery.ts | 10 +- src/models/catalogSubscriptionPlan.ts | 29 +- .../catalogSubscriptionPlanVariation.ts | 31 ++ src/models/checkoutOptions.ts | 6 + src/models/collectedData.ts | 10 + src/models/confirmationDecision.ts | 10 + src/models/confirmationOptions.ts | 25 + .../createMobileAuthorizationCodeResponse.ts | 11 +- src/models/createSubscriptionRequest.ts | 25 +- src/models/createSubscriptionResponse.ts | 6 +- src/models/dataCollectionOptions.ts | 27 + .../deleteSubscriptionActionResponse.ts | 6 +- src/models/dismissTerminalActionResponse.ts | 17 + src/models/employeeWage.ts | 5 +- src/models/getEmployeeWageResponse.ts | 5 +- src/models/inventoryAdjustment.ts | 5 +- src/models/inventoryChange.ts | 5 +- src/models/inventoryPhysicalCount.ts | 5 +- src/models/inventoryTransfer.ts | 5 +- src/models/listSubscriptionEventsRequest.ts | 2 +- src/models/listSubscriptionEventsResponse.ts | 7 +- src/models/listWebhookEventTypesResponse.ts | 5 +- src/models/loyaltyEvent.ts | 5 +- src/models/obtainTokenRequest.ts | 15 +- src/models/order.ts | 5 +- src/models/orderLineItem.ts | 5 +- src/models/orderReturn.ts | 5 +- src/models/orderReturnLineItem.ts | 5 +- src/models/pauseSubscriptionResponse.ts | 6 +- src/models/payout.ts | 3 + src/models/phase.ts | 20 + src/models/phaseInput.ts | 14 + src/models/qrCodeOptions.ts | 20 + src/models/resumeSubscriptionResponse.ts | 6 +- .../retrieveInventoryTransferResponse.ts | 5 +- src/models/retrieveSubscriptionResponse.ts | 6 +- src/models/retrieveTokenStatusResponse.ts | 4 +- src/models/revokeTokenRequest.ts | 2 +- src/models/searchLoyaltyEventsRequest.ts | 5 +- src/models/searchOrdersRequest.ts | 5 +- src/models/searchSubscriptionsRequest.ts | 2 +- src/models/searchSubscriptionsResponse.ts | 2 +- src/models/selectOption.ts | 13 + src/models/selectOptions.ts | 19 + src/models/shiftWage.ts | 11 +- src/models/signatureImage.ts | 16 + src/models/signatureOptions.ts | 17 + src/models/subscription.ts | 16 +- src/models/subscriptionAction.ts | 20 +- src/models/subscriptionEvent.ts | 20 +- src/models/subscriptionPhase.ts | 12 +- src/models/subscriptionPricing.ts | 33 ++ src/models/subscriptionSource.ts | 6 +- src/models/swapPlanRequest.ts | 23 +- src/models/swapPlanResponse.ts | 6 +- src/models/teamMemberWage.ts | 6 + src/models/tender.ts | 10 +- src/models/terminalAction.ts | 59 +- src/models/updateSubscriptionRequest.ts | 6 +- src/models/updateSubscriptionResponse.ts | 6 +- src/models/v1PaymentItemization.ts | 10 +- src/models/v1Settlement.ts | 5 +- 183 files changed, 3768 insertions(+), 2373 deletions(-) create mode 100644 doc/models/catalog-subscription-plan-variation.md create mode 100644 doc/models/collected-data.md create mode 100644 doc/models/confirmation-decision.md create mode 100644 doc/models/confirmation-options.md create mode 100644 doc/models/data-collection-options-input-type.md create mode 100644 doc/models/data-collection-options.md create mode 100644 doc/models/dismiss-terminal-action-response.md create mode 100644 doc/models/phase-input.md create mode 100644 doc/models/phase.md create mode 100644 doc/models/qr-code-options.md create mode 100644 doc/models/select-option.md create mode 100644 doc/models/select-options.md create mode 100644 doc/models/signature-image.md create mode 100644 doc/models/signature-options.md create mode 100644 doc/models/subscription-pricing-type.md create mode 100644 doc/models/subscription-pricing.md create mode 100644 src/models/catalogSubscriptionPlanVariation.ts create mode 100644 src/models/collectedData.ts create mode 100644 src/models/confirmationDecision.ts create mode 100644 src/models/confirmationOptions.ts create mode 100644 src/models/dataCollectionOptions.ts create mode 100644 src/models/dismissTerminalActionResponse.ts create mode 100644 src/models/phase.ts create mode 100644 src/models/phaseInput.ts create mode 100644 src/models/qrCodeOptions.ts create mode 100644 src/models/selectOption.ts create mode 100644 src/models/selectOptions.ts create mode 100644 src/models/signatureImage.ts create mode 100644 src/models/signatureOptions.ts create mode 100644 src/models/subscriptionPricing.ts diff --git a/doc/api/apple-pay.md b/doc/api/apple-pay.md index 59c5210a..698862ec 100644 --- a/doc/api/apple-pay.md +++ b/doc/api/apple-pay.md @@ -44,7 +44,6 @@ async registerDomain( ## Example Usage ```ts -const contentType = null; const body: RegisterDomainRequest = { domainName: 'example.com', }; @@ -53,7 +52,7 @@ try { const { result, ...httpResponse } = await applePayApi.registerDomain(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/bank-accounts.md b/doc/api/bank-accounts.md index f441ac9b..7bfa7a63 100644 --- a/doc/api/bank-accounts.md +++ b/doc/api/bank-accounts.md @@ -48,7 +48,7 @@ try { const { result, ...httpResponse } = await bankAccountsApi.listBankAccounts(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -83,11 +83,12 @@ async getBankAccountByV1Id( ```ts const v1BankAccountId = 'v1_bank_account_id8'; + try { const { result, ...httpResponse } = await bankAccountsApi.getBankAccountByV1Id(v1BankAccountId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -123,11 +124,12 @@ async getBankAccount( ```ts const bankAccountId = 'bank_account_id0'; + try { const { result, ...httpResponse } = await bankAccountsApi.getBankAccount(bankAccountId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/booking-custom-attributes.md b/doc/api/booking-custom-attributes.md index b548859b..8cfee6ff 100644 --- a/doc/api/booking-custom-attributes.md +++ b/doc/api/booking-custom-attributes.md @@ -57,7 +57,7 @@ try { const { result, ...httpResponse } = await bookingCustomAttributesApi.listBookingCustomAttributeDefinitions(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -97,18 +97,15 @@ async createBookingCustomAttributeDefinition( ## Example Usage ```ts -const contentType = null; -const bodyCustomAttributeDefinition: CustomAttributeDefinition = {}; - const body: CreateBookingCustomAttributeDefinitionRequest = { - customAttributeDefinition: bodyCustomAttributeDefinition, + customAttributeDefinition: {}, }; try { const { result, ...httpResponse } = await bookingCustomAttributesApi.createBookingCustomAttributeDefinition(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -149,11 +146,12 @@ async deleteBookingCustomAttributeDefinition( ```ts const key = 'key0'; + try { const { result, ...httpResponse } = await bookingCustomAttributesApi.deleteBookingCustomAttributeDefinition(key); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -193,11 +191,12 @@ async retrieveBookingCustomAttributeDefinition( ```ts const key = 'key0'; + try { const { result, ...httpResponse } = await bookingCustomAttributesApi.retrieveBookingCustomAttributeDefinition(key); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -240,18 +239,19 @@ async updateBookingCustomAttributeDefinition( ```ts const key = 'key0'; -const contentType = null; -const bodyCustomAttributeDefinition: CustomAttributeDefinition = {}; const body: UpdateBookingCustomAttributeDefinitionRequest = { - customAttributeDefinition: bodyCustomAttributeDefinition, + customAttributeDefinition: {}, }; try { - const { result, ...httpResponse } = await bookingCustomAttributesApi.updateBookingCustomAttributeDefinition(key, body); + const { result, ...httpResponse } = await bookingCustomAttributesApi.updateBookingCustomAttributeDefinition( + key, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -291,17 +291,24 @@ async bulkDeleteBookingCustomAttributes( ## Example Usage ```ts -const contentType = null; -const bodyValues: Record = {}; const body: BulkDeleteBookingCustomAttributesRequest = { - values: bodyValues, + values: { + 'key0': { + bookingId: 'booking_id8', + key: 'key4', + }, + 'key1': { + bookingId: 'booking_id9', + key: 'key5', + } + }, }; try { const { result, ...httpResponse } = await bookingCustomAttributesApi.bulkDeleteBookingCustomAttributes(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -341,17 +348,24 @@ async bulkUpsertBookingCustomAttributes( ## Example Usage ```ts -const contentType = null; -const bodyValues: Record = {}; const body: BulkUpsertBookingCustomAttributesRequest = { - values: bodyValues, + values: { + 'key0': { + bookingId: 'booking_id8', + customAttribute: {}, + }, + 'key1': { + bookingId: 'booking_id9', + customAttribute: {}, + } + }, }; try { const { result, ...httpResponse } = await bookingCustomAttributesApi.bulkUpsertBookingCustomAttributes(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -395,12 +409,17 @@ async listBookingCustomAttributes( ```ts const bookingId = 'booking_id4'; + const withDefinitions = false; + try { - const { result, ...httpResponse } = await bookingCustomAttributesApi.listBookingCustomAttributes(bookingId, None, None, withDefinitions); + const { result, ...httpResponse } = await bookingCustomAttributesApi.listBookingCustomAttributes( + bookingId, + withDefinitions + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -443,12 +462,17 @@ async deleteBookingCustomAttribute( ```ts const bookingId = 'booking_id4'; + const key = 'key0'; + try { - const { result, ...httpResponse } = await bookingCustomAttributesApi.deleteBookingCustomAttribute(bookingId, key); + const { result, ...httpResponse } = await bookingCustomAttributesApi.deleteBookingCustomAttribute( + bookingId, + key + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -492,13 +516,20 @@ async retrieveBookingCustomAttribute( ```ts const bookingId = 'booking_id4'; + const key = 'key0'; + const withDefinition = false; + try { - const { result, ...httpResponse } = await bookingCustomAttributesApi.retrieveBookingCustomAttribute(bookingId, key, withDefinition); + const { result, ...httpResponse } = await bookingCustomAttributesApi.retrieveBookingCustomAttribute( + bookingId, + key, + withDefinition + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -543,19 +574,22 @@ async upsertBookingCustomAttribute( ```ts const bookingId = 'booking_id4'; + const key = 'key0'; -const contentType = null; -const bodyCustomAttribute: CustomAttribute = {}; const body: UpsertBookingCustomAttributeRequest = { - customAttribute: bodyCustomAttribute, + customAttribute: {}, }; try { - const { result, ...httpResponse } = await bookingCustomAttributesApi.upsertBookingCustomAttribute(bookingId, key, body); + const { result, ...httpResponse } = await bookingCustomAttributesApi.upsertBookingCustomAttribute( + bookingId, + key, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/bookings.md b/doc/api/bookings.md index 94b89878..183b5117 100644 --- a/doc/api/bookings.md +++ b/doc/api/bookings.md @@ -63,7 +63,7 @@ try { const { result, ...httpResponse } = await bookingsApi.listBookings(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -111,18 +111,15 @@ async createBooking( ## Example Usage ```ts -const contentType = null; -const bodyBooking: Booking = {}; - const body: CreateBookingRequest = { - booking: bodyBooking, + booking: {}, }; try { const { result, ...httpResponse } = await bookingsApi.createBooking(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -159,26 +156,19 @@ async searchAvailability( ## Example Usage ```ts -const contentType = null; -const bodyQueryFilterStartAtRange: TimeRange = {}; - -const bodyQueryFilter: SearchAvailabilityFilter = { - startAtRange: bodyQueryFilterStartAtRange, -}; - -const bodyQuery: SearchAvailabilityQuery = { - filter: bodyQueryFilter, -}; - const body: SearchAvailabilityRequest = { - query: bodyQuery, + query: { + filter: { + startAtRange: {}, + }, + }, }; try { const { result, ...httpResponse } = await bookingsApi.searchAvailability(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -214,7 +204,7 @@ try { const { result, ...httpResponse } = await bookingsApi.retrieveBusinessBookingProfile(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -255,11 +245,14 @@ async listTeamMemberBookingProfiles( ```ts const bookableOnly = false; + try { - const { result, ...httpResponse } = await bookingsApi.listTeamMemberBookingProfiles(bookableOnly); + const { result, ...httpResponse } = await bookingsApi.listTeamMemberBookingProfiles( + bookableOnly + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -294,11 +287,12 @@ async retrieveTeamMemberBookingProfile( ```ts const teamMemberId = 'team_member_id0'; + try { const { result, ...httpResponse } = await bookingsApi.retrieveTeamMemberBookingProfile(teamMemberId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -336,11 +330,12 @@ async retrieveBooking( ```ts const bookingId = 'booking_id4'; + try { const { result, ...httpResponse } = await bookingsApi.retrieveBooking(bookingId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -383,18 +378,19 @@ async updateBooking( ```ts const bookingId = 'booking_id4'; -const contentType = null; -const bodyBooking: Booking = {}; const body: UpdateBookingRequest = { - booking: bodyBooking, + booking: {}, }; try { - const { result, ...httpResponse } = await bookingsApi.updateBooking(bookingId, body); + const { result, ...httpResponse } = await bookingsApi.updateBooking( + bookingId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -437,14 +433,17 @@ async cancelBooking( ```ts const bookingId = 'booking_id4'; -const contentType = null; + const body: CancelBookingRequest = {}; try { - const { result, ...httpResponse } = await bookingsApi.cancelBooking(bookingId, body); + const { result, ...httpResponse } = await bookingsApi.cancelBooking( + bookingId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/cards.md b/doc/api/cards.md index 71af0070..8e787b79 100644 --- a/doc/api/cards.md +++ b/doc/api/cards.md @@ -51,11 +51,14 @@ async listCards( ```ts const includeDisabled = false; + try { - const { result, ...httpResponse } = await cardsApi.listCards(None, None, includeDisabled); + const { result, ...httpResponse } = await cardsApi.listCards( + includeDisabled + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -89,32 +92,29 @@ async createCard( ## Example Usage ```ts -const contentType = null; -const bodyCardBillingAddress: Address = {}; -bodyCardBillingAddress.addressLine1 = '500 Electric Ave'; -bodyCardBillingAddress.addressLine2 = 'Suite 600'; -bodyCardBillingAddress.locality = 'New York'; -bodyCardBillingAddress.administrativeDistrictLevel1 = 'NY'; -bodyCardBillingAddress.postalCode = '10003'; -bodyCardBillingAddress.country = 'US'; - -const bodyCard: Card = {}; -bodyCard.cardholderName = 'Amelia Earhart'; -bodyCard.billingAddress = bodyCardBillingAddress; -bodyCard.customerId = 'VDKXEEKPJN48QDG3BGGFAK05P8'; -bodyCard.referenceId = 'user-id-1'; - const body: CreateCardRequest = { idempotencyKey: '4935a656-a929-4792-b97c-8848be85c27c', sourceId: 'cnon:uIbfJXhXETSP197M3GB', - card: bodyCard, + card: { + cardholderName: 'Amelia Earhart', + billingAddress: { + addressLine1: '500 Electric Ave', + addressLine2: 'Suite 600', + locality: 'New York', + administrativeDistrictLevel1: 'NY', + postalCode: '10003', + country: 'US', + }, + customerId: 'VDKXEEKPJN48QDG3BGGFAK05P8', + referenceId: 'user-id-1', + }, }; try { const { result, ...httpResponse } = await cardsApi.createCard(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -149,11 +149,12 @@ async retrieveCard( ```ts const cardId = 'card_id4'; + try { const { result, ...httpResponse } = await cardsApi.retrieveCard(cardId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -189,11 +190,12 @@ async disableCard( ```ts const cardId = 'card_id4'; + try { const { result, ...httpResponse } = await cardsApi.disableCard(cardId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/cash-drawers.md b/doc/api/cash-drawers.md index 04b08ddd..ba16e8ff 100644 --- a/doc/api/cash-drawers.md +++ b/doc/api/cash-drawers.md @@ -52,11 +52,12 @@ async listCashDrawerShifts( ```ts const locationId = 'location_id4'; + try { const { result, ...httpResponse } = await cashDrawersApi.listCashDrawerShifts(locationId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -94,12 +95,17 @@ async retrieveCashDrawerShift( ```ts const locationId = 'location_id4'; + const shiftId = 'shift_id0'; + try { - const { result, ...httpResponse } = await cashDrawersApi.retrieveCashDrawerShift(locationId, shiftId); + const { result, ...httpResponse } = await cashDrawersApi.retrieveCashDrawerShift( + locationId, + shiftId + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -140,12 +146,17 @@ async listCashDrawerShiftEvents( ```ts const locationId = 'location_id4'; + const shiftId = 'shift_id0'; + try { - const { result, ...httpResponse } = await cashDrawersApi.listCashDrawerShiftEvents(locationId, shiftId); + const { result, ...httpResponse } = await cashDrawersApi.listCashDrawerShiftEvents( + locationId, + shiftId + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/catalog.md b/doc/api/catalog.md index 0dcce39c..7f44dada 100644 --- a/doc/api/catalog.md +++ b/doc/api/catalog.md @@ -64,16 +64,18 @@ async batchDeleteCatalogObjects( ## Example Usage ```ts -const contentType = null; -const bodyObjectIds: string[] = ['W62UWFY35CWMYGVWK6TWJDNI', 'AA27W3M2GGTF3H6AVPNB77CK']; -const body: BatchDeleteCatalogObjectsRequest = {}; -body.objectIds = bodyObjectIds; +const body: BatchDeleteCatalogObjectsRequest = { + objectIds: [ + 'W62UWFY35CWMYGVWK6TWJDNI', + 'AA27W3M2GGTF3H6AVPNB77CK' + ], +}; try { const { result, ...httpResponse } = await catalogApi.batchDeleteCatalogObjects(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -112,18 +114,19 @@ async batchRetrieveCatalogObjects( ## Example Usage ```ts -const contentType = null; -const bodyObjectIds: string[] = ['W62UWFY35CWMYGVWK6TWJDNI', 'AA27W3M2GGTF3H6AVPNB77CK']; const body: BatchRetrieveCatalogObjectsRequest = { - objectIds: bodyObjectIds, + objectIds: [ + 'W62UWFY35CWMYGVWK6TWJDNI', + 'AA27W3M2GGTF3H6AVPNB77CK' + ], + includeRelatedObjects: true, }; -body.includeRelatedObjects = true; try { const { result, ...httpResponse } = await catalogApi.batchRetrieveCatalogObjects(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -169,136 +172,114 @@ async batchUpsertCatalogObjects( ## Example Usage ```ts -const contentType = null; -const bodyBatches: CatalogObjectBatch[] = []; - -const bodybatches0Objects: CatalogObject[] = []; - -const bodybatches0objects0ItemDataTaxIds: string[] = ['#SalesTax']; -const bodybatches0objects0ItemDataVariations: CatalogObject[] = []; - -const bodybatches0objects0ItemDatavariations0ItemVariationData: CatalogItemVariation = {}; -bodybatches0objects0ItemDatavariations0ItemVariationData.itemId = '#Tea'; -bodybatches0objects0ItemDatavariations0ItemVariationData.name = 'Mug'; -bodybatches0objects0ItemDatavariations0ItemVariationData.pricingType = 'FIXED_PRICING'; - -const bodybatches0objects0ItemDatavariations0: CatalogObject = { - type: 'ITEM_VARIATION', - id: '#Tea_Mug', -}; -bodybatches0objects0ItemDatavariations0.presentAtAllLocations = true; -bodybatches0objects0ItemDatavariations0.itemVariationData = bodybatches0objects0ItemDatavariations0ItemVariationData; - -bodybatches0objects0ItemDataVariations[0] = bodybatches0objects0ItemDatavariations0; - -const bodybatches0objects0ItemData: CatalogItem = {}; -bodybatches0objects0ItemData.name = 'Tea'; -bodybatches0objects0ItemData.categoryId = '#Beverages'; -bodybatches0objects0ItemData.taxIds = bodybatches0objects0ItemDataTaxIds; -bodybatches0objects0ItemData.variations = bodybatches0objects0ItemDataVariations; -bodybatches0objects0ItemData.descriptionHtml = '

Hot Leaf Juice

'; - -const bodybatches0objects0: CatalogObject = { - type: 'ITEM', - id: '#Tea', -}; -bodybatches0objects0.presentAtAllLocations = true; -bodybatches0objects0.itemData = bodybatches0objects0ItemData; - -bodybatches0Objects[0] = bodybatches0objects0; - -const bodybatches0objects1ItemDataTaxIds: string[] = ['#SalesTax']; -const bodybatches0objects1ItemDataVariations: CatalogObject[] = []; - -const bodybatches0objects1ItemDatavariations0ItemVariationData: CatalogItemVariation = {}; -bodybatches0objects1ItemDatavariations0ItemVariationData.itemId = '#Coffee'; -bodybatches0objects1ItemDatavariations0ItemVariationData.name = 'Regular'; -bodybatches0objects1ItemDatavariations0ItemVariationData.pricingType = 'FIXED_PRICING'; - -const bodybatches0objects1ItemDatavariations0: CatalogObject = { - type: 'ITEM_VARIATION', - id: '#Coffee_Regular', -}; -bodybatches0objects1ItemDatavariations0.presentAtAllLocations = true; -bodybatches0objects1ItemDatavariations0.itemVariationData = bodybatches0objects1ItemDatavariations0ItemVariationData; - -bodybatches0objects1ItemDataVariations[0] = bodybatches0objects1ItemDatavariations0; - -const bodybatches0objects1ItemDatavariations1ItemVariationData: CatalogItemVariation = {}; -bodybatches0objects1ItemDatavariations1ItemVariationData.itemId = '#Coffee'; -bodybatches0objects1ItemDatavariations1ItemVariationData.name = 'Large'; -bodybatches0objects1ItemDatavariations1ItemVariationData.pricingType = 'FIXED_PRICING'; - -const bodybatches0objects1ItemDatavariations1: CatalogObject = { - type: 'ITEM_VARIATION', - id: '#Coffee_Large', -}; -bodybatches0objects1ItemDatavariations1.presentAtAllLocations = true; -bodybatches0objects1ItemDatavariations1.itemVariationData = bodybatches0objects1ItemDatavariations1ItemVariationData; - -bodybatches0objects1ItemDataVariations[1] = bodybatches0objects1ItemDatavariations1; - -const bodybatches0objects1ItemData: CatalogItem = {}; -bodybatches0objects1ItemData.name = 'Coffee'; -bodybatches0objects1ItemData.categoryId = '#Beverages'; -bodybatches0objects1ItemData.taxIds = bodybatches0objects1ItemDataTaxIds; -bodybatches0objects1ItemData.variations = bodybatches0objects1ItemDataVariations; -bodybatches0objects1ItemData.descriptionHtml = '

Hot Bean Juice

'; - -const bodybatches0objects1: CatalogObject = { - type: 'ITEM', - id: '#Coffee', -}; -bodybatches0objects1.presentAtAllLocations = true; -bodybatches0objects1.itemData = bodybatches0objects1ItemData; - -bodybatches0Objects[1] = bodybatches0objects1; - -const bodybatches0objects2CategoryData: CatalogCategory = {}; -bodybatches0objects2CategoryData.name = 'Beverages'; - -const bodybatches0objects2: CatalogObject = { - type: 'CATEGORY', - id: '#Beverages', -}; -bodybatches0objects2.presentAtAllLocations = true; -bodybatches0objects2.categoryData = bodybatches0objects2CategoryData; - -bodybatches0Objects[2] = bodybatches0objects2; - -const bodybatches0objects3TaxData: CatalogTax = {}; -bodybatches0objects3TaxData.name = 'Sales Tax'; -bodybatches0objects3TaxData.calculationPhase = 'TAX_SUBTOTAL_PHASE'; -bodybatches0objects3TaxData.inclusionType = 'ADDITIVE'; -bodybatches0objects3TaxData.percentage = '5.0'; -bodybatches0objects3TaxData.appliesToCustomAmounts = true; -bodybatches0objects3TaxData.enabled = true; - -const bodybatches0objects3: CatalogObject = { - type: 'TAX', - id: '#SalesTax', -}; -bodybatches0objects3.presentAtAllLocations = true; -bodybatches0objects3.taxData = bodybatches0objects3TaxData; - -bodybatches0Objects[3] = bodybatches0objects3; - -const bodybatches0: CatalogObjectBatch = { - objects: bodybatches0Objects, -}; - -bodyBatches[0] = bodybatches0; - const body: BatchUpsertCatalogObjectsRequest = { idempotencyKey: '789ff020-f723-43a9-b4b5-43b5dc1fa3dc', - batches: bodyBatches, + batches: [ + { + objects: [ + { + type: 'ITEM', + id: '#Tea', + presentAtAllLocations: true, + itemData: { + name: 'Tea', + categoryId: '#Beverages', + taxIds: [ + '#SalesTax' + ], + variations: [ + { + type: 'ITEM_VARIATION', + id: '#Tea_Mug', + presentAtAllLocations: true, + itemVariationData: { + itemId: '#Tea', + name: 'Mug', + pricingType: 'FIXED_PRICING', + priceMoney: { + amount: BigInt(150), + currency: 'USD', + }, + }, + } + ], + descriptionHtml: '

Hot Leaf Juice

', + }, + }, + { + type: 'ITEM', + id: '#Coffee', + presentAtAllLocations: true, + itemData: { + name: 'Coffee', + categoryId: '#Beverages', + taxIds: [ + '#SalesTax' + ], + variations: [ + { + type: 'ITEM_VARIATION', + id: '#Coffee_Regular', + presentAtAllLocations: true, + itemVariationData: { + itemId: '#Coffee', + name: 'Regular', + pricingType: 'FIXED_PRICING', + priceMoney: { + amount: BigInt(250), + currency: 'USD', + }, + }, + }, + { + type: 'ITEM_VARIATION', + id: '#Coffee_Large', + presentAtAllLocations: true, + itemVariationData: { + itemId: '#Coffee', + name: 'Large', + pricingType: 'FIXED_PRICING', + priceMoney: { + amount: BigInt(350), + currency: 'USD', + }, + }, + } + ], + descriptionHtml: '

Hot Bean Juice

', + }, + }, + { + type: 'CATEGORY', + id: '#Beverages', + presentAtAllLocations: true, + categoryData: { + name: 'Beverages', + }, + }, + { + type: 'TAX', + id: '#SalesTax', + presentAtAllLocations: true, + taxData: { + name: 'Sales Tax', + calculationPhase: 'TAX_SUBTOTAL_PHASE', + inclusionType: 'ADDITIVE', + percentage: '5.0', + appliesToCustomAmounts: true, + enabled: true, + }, + } + ], + } + ], }; try { const { result, ...httpResponse } = await catalogApi.batchUpsertCatalogObjects(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -339,26 +320,25 @@ async createCatalogImage( ## Example Usage ```ts -const requestImageImageData: CatalogImage = {}; -requestImageImageData.caption = 'A picture of a cup of coffee'; - -const requestImage: CatalogObject = { - type: 'IMAGE', - id: '#TEMP_ID', -}; -requestImage.imageData = requestImageImageData; - const request: CreateCatalogImageRequest = { idempotencyKey: '528dea59-7bfb-43c1-bd48-4a6bba7dd61f86', - image: requestImage, + image: { + type: 'IMAGE', + id: '#TEMP_ID', + imageData: { + caption: 'A picture of a cup of coffee', + }, + }, + objectId: 'ND6EA5AAJEO5WL3JNNIAQA32', }; -request.objectId = 'ND6EA5AAJEO5WL3JNNIAQA32'; try { - const { result, ...httpResponse } = await catalogApi.createCatalogImage(request); + const { result, ...httpResponse } = await catalogApi.createCatalogImage( + request + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -400,15 +380,19 @@ async updateCatalogImage( ```ts const imageId = 'image_id4'; + const request: UpdateCatalogImageRequest = { idempotencyKey: '528dea59-7bfb-43c1-bd48-4a6bba7dd61f86', }; try { - const { result, ...httpResponse } = await catalogApi.updateCatalogImage(imageId, request); + const { result, ...httpResponse } = await catalogApi.updateCatalogImage( + imageId, + request + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -445,7 +429,7 @@ try { const { result, ...httpResponse } = await catalogApi.catalogInfo(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -494,7 +478,7 @@ try { const { result, ...httpResponse } = await catalogApi.listCatalog(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -532,62 +516,48 @@ async upsertCatalogObject( ## Example Usage ```ts -const contentType = null; -const bodyObjectItemDataVariations: CatalogObject[] = []; - -const bodyObjectItemDatavariations0ItemVariationData: CatalogItemVariation = {}; -bodyObjectItemDatavariations0ItemVariationData.itemId = '#Cocoa'; -bodyObjectItemDatavariations0ItemVariationData.name = 'Small'; -bodyObjectItemDatavariations0ItemVariationData.pricingType = 'VARIABLE_PRICING'; - -const bodyObjectItemDatavariations0: CatalogObject = { - type: 'ITEM_VARIATION', - id: '#Small', -}; -bodyObjectItemDatavariations0.itemVariationData = bodyObjectItemDatavariations0ItemVariationData; - -bodyObjectItemDataVariations[0] = bodyObjectItemDatavariations0; - -const bodyObjectItemDatavariations1ItemVariationDataPriceMoney: Money = {}; -bodyObjectItemDatavariations1ItemVariationDataPriceMoney.amount = BigInt(400); -bodyObjectItemDatavariations1ItemVariationDataPriceMoney.currency = 'USD'; - -const bodyObjectItemDatavariations1ItemVariationData: CatalogItemVariation = {}; -bodyObjectItemDatavariations1ItemVariationData.itemId = '#Cocoa'; -bodyObjectItemDatavariations1ItemVariationData.name = 'Large'; -bodyObjectItemDatavariations1ItemVariationData.pricingType = 'FIXED_PRICING'; -bodyObjectItemDatavariations1ItemVariationData.priceMoney = bodyObjectItemDatavariations1ItemVariationDataPriceMoney; - -const bodyObjectItemDatavariations1: CatalogObject = { - type: 'ITEM_VARIATION', - id: '#Large', -}; -bodyObjectItemDatavariations1.itemVariationData = bodyObjectItemDatavariations1ItemVariationData; - -bodyObjectItemDataVariations[1] = bodyObjectItemDatavariations1; - -const bodyObjectItemData: CatalogItem = {}; -bodyObjectItemData.name = 'Cocoa'; -bodyObjectItemData.abbreviation = 'Ch'; -bodyObjectItemData.variations = bodyObjectItemDataVariations; -bodyObjectItemData.descriptionHtml = '

Hot Chocolate

'; - -const bodyObject: CatalogObject = { - type: 'ITEM', - id: '#Cocoa', -}; -bodyObject.itemData = bodyObjectItemData; - const body: UpsertCatalogObjectRequest = { idempotencyKey: 'af3d1afc-7212-4300-b463-0bfc5314a5ae', - object: bodyObject, + object: { + type: 'ITEM', + id: '#Cocoa', + itemData: { + name: 'Cocoa', + abbreviation: 'Ch', + variations: [ + { + type: 'ITEM_VARIATION', + id: '#Small', + itemVariationData: { + itemId: '#Cocoa', + name: 'Small', + pricingType: 'VARIABLE_PRICING', + }, + }, + { + type: 'ITEM_VARIATION', + id: '#Large', + itemVariationData: { + itemId: '#Cocoa', + name: 'Large', + pricingType: 'FIXED_PRICING', + priceMoney: { + amount: BigInt(400), + currency: 'USD', + }, + }, + } + ], + descriptionHtml: '

Hot Chocolate

', + }, + }, }; try { const { result, ...httpResponse } = await catalogApi.upsertCatalogObject(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -631,11 +601,12 @@ async deleteCatalogObject( ```ts const objectId = 'object_id8'; + try { const { result, ...httpResponse } = await catalogApi.deleteCatalogObject(objectId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -680,12 +651,17 @@ async retrieveCatalogObject( ```ts const objectId = 'object_id8'; + const includeRelatedObjects = false; + try { - const { result, ...httpResponse } = await catalogApi.retrieveCatalogObject(objectId, includeRelatedObjects); + const { result, ...httpResponse } = await catalogApi.retrieveCatalogObject( + objectId, + includeRelatedObjects + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -728,26 +704,24 @@ async searchCatalogObjects( ## Example Usage ```ts -const contentType = null; -const bodyObjectTypes: string[] = ['ITEM']; -const bodyQueryPrefixQuery: CatalogQueryPrefix = { - attributeName: 'name', - attributePrefix: 'tea', +const body: SearchCatalogObjectsRequest = { + objectTypes: [ + 'ITEM' + ], + query: { + prefixQuery: { + attributeName: 'name', + attributePrefix: 'tea', + }, + }, + limit: 100, }; -const bodyQuery: CatalogQuery = {}; -bodyQuery.prefixQuery = bodyQueryPrefixQuery; - -const body: SearchCatalogObjectsRequest = {}; -body.objectTypes = bodyObjectTypes; -body.query = bodyQuery; -body.limit = 100; - try { const { result, ...httpResponse } = await catalogApi.searchCatalogObjects(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -790,55 +764,50 @@ async searchCatalogItems( ## Example Usage ```ts -const contentType = null; -const bodyCategoryIds: string[] = ['WINE_CATEGORY_ID']; -const bodyStockLevels: string[] = ['OUT', 'LOW']; -const bodyEnabledLocationIds: string[] = ['ATL_LOCATION_ID']; -const bodyProductTypes: string[] = ['REGULAR']; -const bodyCustomAttributeFilters: CustomAttributeFilter[] = []; - -const bodycustomAttributeFilters0: CustomAttributeFilter = {}; -bodycustomAttributeFilters0.customAttributeDefinitionId = 'VEGAN_DEFINITION_ID'; -bodycustomAttributeFilters0.boolFilter = true; - -bodyCustomAttributeFilters[0] = bodycustomAttributeFilters0; - -const bodycustomAttributeFilters1: CustomAttributeFilter = {}; -bodycustomAttributeFilters1.customAttributeDefinitionId = 'BRAND_DEFINITION_ID'; -bodycustomAttributeFilters1.stringFilter = 'Dark Horse'; - -bodyCustomAttributeFilters[1] = bodycustomAttributeFilters1; - -const bodycustomAttributeFilters2NumberFilter: Range = {}; -bodycustomAttributeFilters2NumberFilter.min = '2017'; -bodycustomAttributeFilters2NumberFilter.max = '2018'; - -const bodycustomAttributeFilters2: CustomAttributeFilter = {}; -bodycustomAttributeFilters2.key = 'VINTAGE'; -bodycustomAttributeFilters2.numberFilter = bodycustomAttributeFilters2NumberFilter; - -bodyCustomAttributeFilters[2] = bodycustomAttributeFilters2; - -const bodycustomAttributeFilters3: CustomAttributeFilter = {}; -bodycustomAttributeFilters3.customAttributeDefinitionId = 'VARIETAL_DEFINITION_ID'; - -bodyCustomAttributeFilters[3] = bodycustomAttributeFilters3; - -const body: SearchCatalogItemsRequest = {}; -body.textFilter = 'red'; -body.categoryIds = bodyCategoryIds; -body.stockLevels = bodyStockLevels; -body.enabledLocationIds = bodyEnabledLocationIds; -body.limit = 100; -body.sortOrder = 'ASC'; -body.productTypes = bodyProductTypes; -body.customAttributeFilters = bodyCustomAttributeFilters; +const body: SearchCatalogItemsRequest = { + textFilter: 'red', + categoryIds: [ + 'WINE_CATEGORY_ID' + ], + stockLevels: [ + 'OUT', + 'LOW' + ], + enabledLocationIds: [ + 'ATL_LOCATION_ID' + ], + limit: 100, + sortOrder: 'ASC', + productTypes: [ + 'REGULAR' + ], + customAttributeFilters: [ + { + customAttributeDefinitionId: 'VEGAN_DEFINITION_ID', + boolFilter: true, + }, + { + customAttributeDefinitionId: 'BRAND_DEFINITION_ID', + stringFilter: 'Dark Horse', + }, + { + key: 'VINTAGE', + numberFilter: { + min: '2017', + max: '2018', + }, + }, + { + customAttributeDefinitionId: 'VARIETAL_DEFINITION_ID', + } + ], +}; try { const { result, ...httpResponse } = await catalogApi.searchCatalogItems(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -874,21 +843,25 @@ async updateItemModifierLists( ## Example Usage ```ts -const contentType = null; -const bodyItemIds: string[] = ['H42BRLUJ5KTZTTMPVSLFAACQ', '2JXOBJIHCWBQ4NZ3RIXQGJA6']; -const bodyModifierListsToEnable: string[] = ['H42BRLUJ5KTZTTMPVSLFAACQ', '2JXOBJIHCWBQ4NZ3RIXQGJA6']; -const bodyModifierListsToDisable: string[] = ['7WRC16CJZDVLSNDQ35PP6YAD']; const body: UpdateItemModifierListsRequest = { - itemIds: bodyItemIds, + itemIds: [ + 'H42BRLUJ5KTZTTMPVSLFAACQ', + '2JXOBJIHCWBQ4NZ3RIXQGJA6' + ], + modifierListsToEnable: [ + 'H42BRLUJ5KTZTTMPVSLFAACQ', + '2JXOBJIHCWBQ4NZ3RIXQGJA6' + ], + modifierListsToDisable: [ + '7WRC16CJZDVLSNDQ35PP6YAD' + ], }; -body.modifierListsToEnable = bodyModifierListsToEnable; -body.modifierListsToDisable = bodyModifierListsToDisable; try { const { result, ...httpResponse } = await catalogApi.updateItemModifierLists(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -924,21 +897,24 @@ async updateItemTaxes( ## Example Usage ```ts -const contentType = null; -const bodyItemIds: string[] = ['H42BRLUJ5KTZTTMPVSLFAACQ', '2JXOBJIHCWBQ4NZ3RIXQGJA6']; -const bodyTaxesToEnable: string[] = ['4WRCNHCJZDVLSNDQ35PP6YAD']; -const bodyTaxesToDisable: string[] = ['AQCEGCEBBQONINDOHRGZISEX']; const body: UpdateItemTaxesRequest = { - itemIds: bodyItemIds, + itemIds: [ + 'H42BRLUJ5KTZTTMPVSLFAACQ', + '2JXOBJIHCWBQ4NZ3RIXQGJA6' + ], + taxesToEnable: [ + '4WRCNHCJZDVLSNDQ35PP6YAD' + ], + taxesToDisable: [ + 'AQCEGCEBBQONINDOHRGZISEX' + ], }; -body.taxesToEnable = bodyTaxesToEnable; -body.taxesToDisable = bodyTaxesToDisable; try { const { result, ...httpResponse } = await catalogApi.updateItemTaxes(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/checkout.md b/doc/api/checkout.md index 47229fe5..aef94c2e 100644 --- a/doc/api/checkout.md +++ b/doc/api/checkout.md @@ -55,140 +55,106 @@ async createCheckout( ```ts const locationId = 'location_id4'; -const contentType = null; -const bodyOrderOrderLineItems: OrderLineItem[] = []; - -const bodyOrderOrderlineItems0AppliedTaxes: OrderLineItemAppliedTax[] = []; - -const bodyOrderOrderlineItems0appliedTaxes0: OrderLineItemAppliedTax = { - taxUid: '38ze1696-z1e3-5628-af6d-f1e04d947fg3', -}; - -bodyOrderOrderlineItems0AppliedTaxes[0] = bodyOrderOrderlineItems0appliedTaxes0; - -const bodyOrderOrderlineItems0AppliedDiscounts: OrderLineItemAppliedDiscount[] = []; - -const bodyOrderOrderlineItems0appliedDiscounts0: OrderLineItemAppliedDiscount = { - discountUid: '56ae1696-z1e3-9328-af6d-f1e04d947gd4', -}; - -bodyOrderOrderlineItems0AppliedDiscounts[0] = bodyOrderOrderlineItems0appliedDiscounts0; - -const bodyOrderOrderlineItems0BasePriceMoney: Money = {}; -bodyOrderOrderlineItems0BasePriceMoney.amount = BigInt(1500); -bodyOrderOrderlineItems0BasePriceMoney.currency = 'USD'; - -const bodyOrderOrderlineItems0: OrderLineItem = { - quantity: '2', -}; -bodyOrderOrderlineItems0.name = 'Printed T Shirt'; -bodyOrderOrderlineItems0.appliedTaxes = bodyOrderOrderlineItems0AppliedTaxes; -bodyOrderOrderlineItems0.appliedDiscounts = bodyOrderOrderlineItems0AppliedDiscounts; -bodyOrderOrderlineItems0.basePriceMoney = bodyOrderOrderlineItems0BasePriceMoney; - -bodyOrderOrderLineItems[0] = bodyOrderOrderlineItems0; - -const bodyOrderOrderlineItems1BasePriceMoney: Money = {}; -bodyOrderOrderlineItems1BasePriceMoney.amount = BigInt(2500); -bodyOrderOrderlineItems1BasePriceMoney.currency = 'USD'; - -const bodyOrderOrderlineItems1: OrderLineItem = { - quantity: '1', -}; -bodyOrderOrderlineItems1.name = 'Slim Jeans'; -bodyOrderOrderlineItems1.basePriceMoney = bodyOrderOrderlineItems1BasePriceMoney; - -bodyOrderOrderLineItems[1] = bodyOrderOrderlineItems1; - -const bodyOrderOrderlineItems2BasePriceMoney: Money = {}; -bodyOrderOrderlineItems2BasePriceMoney.amount = BigInt(3500); -bodyOrderOrderlineItems2BasePriceMoney.currency = 'USD'; - -const bodyOrderOrderlineItems2: OrderLineItem = { - quantity: '3', -}; -bodyOrderOrderlineItems2.name = 'Woven Sweater'; -bodyOrderOrderlineItems2.basePriceMoney = bodyOrderOrderlineItems2BasePriceMoney; - -bodyOrderOrderLineItems[2] = bodyOrderOrderlineItems2; - -const bodyOrderOrderTaxes: OrderLineItemTax[] = []; - -const bodyOrderOrdertaxes0: OrderLineItemTax = {}; -bodyOrderOrdertaxes0.uid = '38ze1696-z1e3-5628-af6d-f1e04d947fg3'; -bodyOrderOrdertaxes0.type = 'INCLUSIVE'; -bodyOrderOrdertaxes0.percentage = '7.75'; -bodyOrderOrdertaxes0.scope = 'LINE_ITEM'; - -bodyOrderOrderTaxes[0] = bodyOrderOrdertaxes0; - -const bodyOrderOrderDiscounts: OrderLineItemDiscount[] = []; - -const bodyOrderOrderdiscounts0AmountMoney: Money = {}; -bodyOrderOrderdiscounts0AmountMoney.amount = BigInt(100); -bodyOrderOrderdiscounts0AmountMoney.currency = 'USD'; - -const bodyOrderOrderdiscounts0: OrderLineItemDiscount = {}; -bodyOrderOrderdiscounts0.uid = '56ae1696-z1e3-9328-af6d-f1e04d947gd4'; -bodyOrderOrderdiscounts0.type = 'FIXED_AMOUNT'; -bodyOrderOrderdiscounts0.amountMoney = bodyOrderOrderdiscounts0AmountMoney; -bodyOrderOrderdiscounts0.scope = 'LINE_ITEM'; - -bodyOrderOrderDiscounts[0] = bodyOrderOrderdiscounts0; - -const bodyOrderOrder: Order = { - locationId: 'location_id', -}; -bodyOrderOrder.referenceId = 'reference_id'; -bodyOrderOrder.customerId = 'customer_id'; -bodyOrderOrder.lineItems = bodyOrderOrderLineItems; -bodyOrderOrder.taxes = bodyOrderOrderTaxes; -bodyOrderOrder.discounts = bodyOrderOrderDiscounts; - -const bodyOrder: CreateOrderRequest = {}; -bodyOrder.order = bodyOrderOrder; -bodyOrder.idempotencyKey = '12ae1696-z1e3-4328-af6d-f1e04d947gd4'; - -const bodyPrePopulateShippingAddress: Address = {}; -bodyPrePopulateShippingAddress.addressLine1 = '1455 Market St.'; -bodyPrePopulateShippingAddress.addressLine2 = 'Suite 600'; -bodyPrePopulateShippingAddress.locality = 'San Francisco'; -bodyPrePopulateShippingAddress.administrativeDistrictLevel1 = 'CA'; -bodyPrePopulateShippingAddress.postalCode = '94103'; -bodyPrePopulateShippingAddress.country = 'US'; -bodyPrePopulateShippingAddress.firstName = 'Jane'; -bodyPrePopulateShippingAddress.lastName = 'Doe'; - -const bodyAdditionalRecipients: ChargeRequestAdditionalRecipient[] = []; - -const bodyadditionalRecipients0AmountMoney: Money = {}; -bodyadditionalRecipients0AmountMoney.amount = BigInt(60); -bodyadditionalRecipients0AmountMoney.currency = 'USD'; - -const bodyadditionalRecipients0: ChargeRequestAdditionalRecipient = { - locationId: '057P5VYJ4A5X1', - description: 'Application fees', - amountMoney: bodyadditionalRecipients0AmountMoney, -}; - -bodyAdditionalRecipients[0] = bodyadditionalRecipients0; const body: CreateCheckoutRequest = { idempotencyKey: '86ae1696-b1e3-4328-af6d-f1e04d947ad6', - order: bodyOrder, + order: { + order: { + locationId: 'location_id', + referenceId: 'reference_id', + customerId: 'customer_id', + lineItems: [ + { + quantity: '2', + name: 'Printed T Shirt', + appliedTaxes: [ + { + taxUid: '38ze1696-z1e3-5628-af6d-f1e04d947fg3', + } + ], + appliedDiscounts: [ + { + discountUid: '56ae1696-z1e3-9328-af6d-f1e04d947gd4', + } + ], + basePriceMoney: { + amount: BigInt(1500), + currency: 'USD', + }, + }, + { + quantity: '1', + name: 'Slim Jeans', + basePriceMoney: { + amount: BigInt(2500), + currency: 'USD', + }, + }, + { + quantity: '3', + name: 'Woven Sweater', + basePriceMoney: { + amount: BigInt(3500), + currency: 'USD', + }, + } + ], + taxes: [ + { + uid: '38ze1696-z1e3-5628-af6d-f1e04d947fg3', + type: 'INCLUSIVE', + percentage: '7.75', + scope: 'LINE_ITEM', + } + ], + discounts: [ + { + uid: '56ae1696-z1e3-9328-af6d-f1e04d947gd4', + type: 'FIXED_AMOUNT', + amountMoney: { + amount: BigInt(100), + currency: 'USD', + }, + scope: 'LINE_ITEM', + } + ], + }, + idempotencyKey: '12ae1696-z1e3-4328-af6d-f1e04d947gd4', + }, + askForShippingAddress: true, + merchantSupportEmail: 'merchant+support@website.com', + prePopulateBuyerEmail: 'example@email.com', + prePopulateShippingAddress: { + addressLine1: '1455 Market St.', + addressLine2: 'Suite 600', + locality: 'San Francisco', + administrativeDistrictLevel1: 'CA', + postalCode: '94103', + country: 'US', + firstName: 'Jane', + lastName: 'Doe', + }, + redirectUrl: 'https://merchant.website.com/order-confirm', + additionalRecipients: [ + { + locationId: '057P5VYJ4A5X1', + description: 'Application fees', + amountMoney: { + amount: BigInt(60), + currency: 'USD', + }, + } + ], }; -body.askForShippingAddress = true; -body.merchantSupportEmail = 'merchant+support@website.com'; -body.prePopulateBuyerEmail = 'example@email.com'; -body.prePopulateShippingAddress = bodyPrePopulateShippingAddress; -body.redirectUrl = 'https://merchant.website.com/order-confirm'; -body.additionalRecipients = bodyAdditionalRecipients; try { - const { result, ...httpResponse } = await checkoutApi.createCheckout(locationId, body); + const { result, ...httpResponse } = await checkoutApi.createCheckout( + locationId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -228,7 +194,7 @@ try { const { result, ...httpResponse } = await checkoutApi.listPaymentLinks(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -262,26 +228,23 @@ async createPaymentLink( ## Example Usage ```ts -const contentType = null; -const bodyQuickPayPriceMoney: Money = {}; -bodyQuickPayPriceMoney.amount = BigInt(10000); -bodyQuickPayPriceMoney.currency = 'USD'; - -const bodyQuickPay: QuickPay = { - name: 'Auto Detailing', - priceMoney: bodyQuickPayPriceMoney, - locationId: 'A9Y43N9ABXZBP', +const body: CreatePaymentLinkRequest = { + idempotencyKey: 'cd9e25dc-d9f2-4430-aedb-61605070e95f', + quickPay: { + name: 'Auto Detailing', + priceMoney: { + amount: BigInt(10000), + currency: 'USD', + }, + locationId: 'A9Y43N9ABXZBP', + }, }; -const body: CreatePaymentLinkRequest = {}; -body.idempotencyKey = 'cd9e25dc-d9f2-4430-aedb-61605070e95f'; -body.quickPay = bodyQuickPay; - try { const { result, ...httpResponse } = await checkoutApi.createPaymentLink(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -316,11 +279,12 @@ async deletePaymentLink( ```ts const id = 'id0'; + try { const { result, ...httpResponse } = await checkoutApi.deletePaymentLink(id); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -355,11 +319,12 @@ async retrievePaymentLink( ```ts const id = 'id0'; + try { const { result, ...httpResponse } = await checkoutApi.retrievePaymentLink(id); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -398,24 +363,24 @@ async updatePaymentLink( ```ts const id = 'id0'; -const contentType = null; -const bodyPaymentLinkCheckoutOptions: CheckoutOptions = {}; -bodyPaymentLinkCheckoutOptions.askForShippingAddress = true; - -const bodyPaymentLink: PaymentLink = { - version: 1, -}; -bodyPaymentLink.checkoutOptions = bodyPaymentLinkCheckoutOptions; const body: UpdatePaymentLinkRequest = { - paymentLink: bodyPaymentLink, + paymentLink: { + version: 1, + checkoutOptions: { + askForShippingAddress: true, + }, + }, }; try { - const { result, ...httpResponse } = await checkoutApi.updatePaymentLink(id, body); + const { result, ...httpResponse } = await checkoutApi.updatePaymentLink( + id, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/customer-custom-attributes.md b/doc/api/customer-custom-attributes.md index 1019782b..3ab5b035 100644 --- a/doc/api/customer-custom-attributes.md +++ b/doc/api/customer-custom-attributes.md @@ -58,7 +58,7 @@ try { const { result, ...httpResponse } = await customerCustomAttributesApi.listCustomerCustomAttributeDefinitions(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -102,22 +102,20 @@ async createCustomerCustomAttributeDefinition( ## Example Usage ```ts -const contentType = null; -const bodyCustomAttributeDefinition: CustomAttributeDefinition = {}; -bodyCustomAttributeDefinition.key = 'favoritemovie'; -bodyCustomAttributeDefinition.name = 'Favorite Movie'; -bodyCustomAttributeDefinition.description = 'The favorite movie of the customer.'; -bodyCustomAttributeDefinition.visibility = 'VISIBILITY_HIDDEN'; - const body: CreateCustomerCustomAttributeDefinitionRequest = { - customAttributeDefinition: bodyCustomAttributeDefinition, + customAttributeDefinition: { + key: 'favoritemovie', + name: 'Favorite Movie', + description: 'The favorite movie of the customer.', + visibility: 'VISIBILITY_HIDDEN', + }, }; try { const { result, ...httpResponse } = await customerCustomAttributesApi.createCustomerCustomAttributeDefinition(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -157,11 +155,12 @@ async deleteCustomerCustomAttributeDefinition( ```ts const key = 'key0'; + try { const { result, ...httpResponse } = await customerCustomAttributesApi.deleteCustomerCustomAttributeDefinition(key); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -202,11 +201,12 @@ async retrieveCustomerCustomAttributeDefinition( ```ts const key = 'key0'; + try { const { result, ...httpResponse } = await customerCustomAttributesApi.retrieveCustomerCustomAttributeDefinition(key); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -249,20 +249,22 @@ async updateCustomerCustomAttributeDefinition( ```ts const key = 'key0'; -const contentType = null; -const bodyCustomAttributeDefinition: CustomAttributeDefinition = {}; -bodyCustomAttributeDefinition.description = 'Update the description as desired.'; -bodyCustomAttributeDefinition.visibility = 'VISIBILITY_READ_ONLY'; const body: UpdateCustomerCustomAttributeDefinitionRequest = { - customAttributeDefinition: bodyCustomAttributeDefinition, + customAttributeDefinition: { + description: 'Update the description as desired.', + visibility: 'VISIBILITY_READ_ONLY', + }, }; try { - const { result, ...httpResponse } = await customerCustomAttributesApi.updateCustomerCustomAttributeDefinition(key, body); + const { result, ...httpResponse } = await customerCustomAttributesApi.updateCustomerCustomAttributeDefinition( + key, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -309,17 +311,24 @@ async bulkUpsertCustomerCustomAttributes( ## Example Usage ```ts -const contentType = null; -const bodyValues: Record = {}; const body: BulkUpsertCustomerCustomAttributesRequest = { - values: bodyValues, + values: { + 'key0': { + customerId: 'customer_id2', + customAttribute: {}, + }, + 'key1': { + customerId: 'customer_id3', + customAttribute: {}, + } + }, }; try { const { result, ...httpResponse } = await customerCustomAttributesApi.bulkUpsertCustomerCustomAttributes(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -367,12 +376,17 @@ async listCustomerCustomAttributes( ```ts const customerId = 'customer_id8'; + const withDefinitions = false; + try { - const { result, ...httpResponse } = await customerCustomAttributesApi.listCustomerCustomAttributes(customerId, None, None, withDefinitions); + const { result, ...httpResponse } = await customerCustomAttributesApi.listCustomerCustomAttributes( + customerId, + withDefinitions + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -413,12 +427,17 @@ async deleteCustomerCustomAttribute( ```ts const customerId = 'customer_id8'; + const key = 'key0'; + try { - const { result, ...httpResponse } = await customerCustomAttributesApi.deleteCustomerCustomAttribute(customerId, key); + const { result, ...httpResponse } = await customerCustomAttributesApi.deleteCustomerCustomAttribute( + customerId, + key + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -466,13 +485,20 @@ async retrieveCustomerCustomAttribute( ```ts const customerId = 'customer_id8'; + const key = 'key0'; + const withDefinition = false; + try { - const { result, ...httpResponse } = await customerCustomAttributesApi.retrieveCustomerCustomAttribute(customerId, key, withDefinition); + const { result, ...httpResponse } = await customerCustomAttributesApi.retrieveCustomerCustomAttribute( + customerId, + key, + withDefinition + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -519,19 +545,22 @@ async upsertCustomerCustomAttribute( ```ts const customerId = 'customer_id8'; + const key = 'key0'; -const contentType = null; -const bodyCustomAttribute: CustomAttribute = {}; const body: UpsertCustomerCustomAttributeRequest = { - customAttribute: bodyCustomAttribute, + customAttribute: {}, }; try { - const { result, ...httpResponse } = await customerCustomAttributesApi.upsertCustomerCustomAttribute(customerId, key, body); + const { result, ...httpResponse } = await customerCustomAttributesApi.upsertCustomerCustomAttribute( + customerId, + key, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/customer-groups.md b/doc/api/customer-groups.md index dca4b3aa..d33b5fb1 100644 --- a/doc/api/customer-groups.md +++ b/doc/api/customer-groups.md @@ -48,7 +48,7 @@ try { const { result, ...httpResponse } = await customerGroupsApi.listCustomerGroups(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -84,20 +84,17 @@ async createCustomerGroup( ## Example Usage ```ts -const contentType = null; -const bodyGroup: CustomerGroup = { - name: 'Loyal Customers', -}; - const body: CreateCustomerGroupRequest = { - group: bodyGroup, + group: { + name: 'Loyal Customers', + }, }; try { const { result, ...httpResponse } = await customerGroupsApi.createCustomerGroup(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -132,11 +129,12 @@ async deleteCustomerGroup( ```ts const groupId = 'group_id0'; + try { const { result, ...httpResponse } = await customerGroupsApi.deleteCustomerGroup(groupId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -171,11 +169,12 @@ async retrieveCustomerGroup( ```ts const groupId = 'group_id0'; + try { const { result, ...httpResponse } = await customerGroupsApi.retrieveCustomerGroup(groupId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -212,20 +211,21 @@ async updateCustomerGroup( ```ts const groupId = 'group_id0'; -const contentType = null; -const bodyGroup: CustomerGroup = { - name: 'Loyal Customers', -}; const body: UpdateCustomerGroupRequest = { - group: bodyGroup, + group: { + name: 'Loyal Customers', + }, }; try { - const { result, ...httpResponse } = await customerGroupsApi.updateCustomerGroup(groupId, body); + const { result, ...httpResponse } = await customerGroupsApi.updateCustomerGroup( + groupId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/customer-segments.md b/doc/api/customer-segments.md index 617c0672..01e1370d 100644 --- a/doc/api/customer-segments.md +++ b/doc/api/customer-segments.md @@ -45,7 +45,7 @@ try { const { result, ...httpResponse } = await customerSegmentsApi.listCustomerSegments(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -80,11 +80,12 @@ async retrieveCustomerSegment( ```ts const segmentId = 'segment_id4'; + try { const { result, ...httpResponse } = await customerSegmentsApi.retrieveCustomerSegment(segmentId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/customers.md b/doc/api/customers.md index c8aaa04f..a5d8d961 100644 --- a/doc/api/customers.md +++ b/doc/api/customers.md @@ -61,7 +61,7 @@ try { const { result, ...httpResponse } = await customersApi.listCustomers(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -104,29 +104,28 @@ async createCustomer( ## Example Usage ```ts -const contentType = null; -const bodyAddress: Address = {}; -bodyAddress.addressLine1 = '500 Electric Ave'; -bodyAddress.addressLine2 = 'Suite 600'; -bodyAddress.locality = 'New York'; -bodyAddress.administrativeDistrictLevel1 = 'NY'; -bodyAddress.postalCode = '10003'; -bodyAddress.country = 'US'; - -const body: CreateCustomerRequest = {}; -body.givenName = 'Amelia'; -body.familyName = 'Earhart'; -body.emailAddress = 'Amelia.Earhart@example.com'; -body.address = bodyAddress; -body.phoneNumber = '+1-212-555-4240'; -body.referenceId = 'YOUR_REFERENCE_ID'; -body.note = 'a customer'; +const body: CreateCustomerRequest = { + givenName: 'Amelia', + familyName: 'Earhart', + emailAddress: 'Amelia.Earhart@example.com', + address: { + addressLine1: '500 Electric Ave', + addressLine2: 'Suite 600', + locality: 'New York', + administrativeDistrictLevel1: 'NY', + postalCode: '10003', + country: 'US', + }, + phoneNumber: '+1-212-555-4240', + referenceId: 'YOUR_REFERENCE_ID', + note: 'a customer', +}; try { const { result, ...httpResponse } = await customersApi.createCustomer(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -168,46 +167,41 @@ async searchCustomers( ## Example Usage ```ts -const contentType = null; -const bodyQueryFilterCreationSourceValues: string[] = ['THIRD_PARTY']; -const bodyQueryFilterCreationSource: CustomerCreationSourceFilter = {}; -bodyQueryFilterCreationSource.values = bodyQueryFilterCreationSourceValues; -bodyQueryFilterCreationSource.rule = 'INCLUDE'; - -const bodyQueryFilterCreatedAt: TimeRange = {}; -bodyQueryFilterCreatedAt.startAt = '2018-01-01T00:00:00+00:00'; -bodyQueryFilterCreatedAt.endAt = '2018-02-01T00:00:00+00:00'; - -const bodyQueryFilterEmailAddress: CustomerTextFilter = {}; -bodyQueryFilterEmailAddress.fuzzy = 'example.com'; - -const bodyQueryFilterGroupIdsAll: string[] = ['545AXB44B4XXWMVQ4W8SBT3HHF']; -const bodyQueryFilterGroupIds: FilterValue = {}; -bodyQueryFilterGroupIds.all = bodyQueryFilterGroupIdsAll; - -const bodyQueryFilter: CustomerFilter = {}; -bodyQueryFilter.creationSource = bodyQueryFilterCreationSource; -bodyQueryFilter.createdAt = bodyQueryFilterCreatedAt; -bodyQueryFilter.emailAddress = bodyQueryFilterEmailAddress; -bodyQueryFilter.groupIds = bodyQueryFilterGroupIds; - -const bodyQuerySort: CustomerSort = {}; -bodyQuerySort.field = 'CREATED_AT'; -bodyQuerySort.order = 'ASC'; - -const bodyQuery: CustomerQuery = {}; -bodyQuery.filter = bodyQueryFilter; -bodyQuery.sort = bodyQuerySort; - -const body: SearchCustomersRequest = {}; -body.limit = BigInt(2); -body.query = bodyQuery; +const body: SearchCustomersRequest = { + limit: BigInt(2), + query: { + filter: { + creationSource: { + values: [ + 'THIRD_PARTY' + ], + rule: 'INCLUDE', + }, + createdAt: { + startAt: '2018-01-01T00:00:00+00:00', + endAt: '2018-02-01T00:00:00+00:00', + }, + emailAddress: { + fuzzy: 'example.com', + }, + groupIds: { + all: [ + '545AXB44B4XXWMVQ4W8SBT3HHF' + ], + }, + }, + sort: { + field: 'CREATED_AT', + order: 'ASC', + }, + }, +}; try { const { result, ...httpResponse } = await customersApi.searchCustomers(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -249,11 +243,12 @@ async deleteCustomer( ```ts const customerId = 'customer_id8'; + try { const { result, ...httpResponse } = await customersApi.deleteCustomer(customerId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -288,11 +283,12 @@ async retrieveCustomer( ```ts const customerId = 'customer_id8'; + try { const { result, ...httpResponse } = await customersApi.retrieveCustomer(customerId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -338,18 +334,22 @@ async updateCustomer( ```ts const customerId = 'customer_id8'; -const contentType = null; -const body: UpdateCustomerRequest = {}; -body.emailAddress = 'New.Amelia.Earhart@example.com'; -body.phoneNumber = ''; -body.note = 'updated customer note'; -body.version = BigInt(2); + +const body: UpdateCustomerRequest = { + emailAddress: 'New.Amelia.Earhart@example.com', + phoneNumber: '', + note: 'updated customer note', + version: BigInt(2), +}; try { - const { result, ...httpResponse } = await customersApi.updateCustomer(customerId, body); + const { result, ...httpResponse } = await customersApi.updateCustomer( + customerId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -392,26 +392,28 @@ async createCustomerCard( ```ts const customerId = 'customer_id8'; -const contentType = null; -const bodyBillingAddress: Address = {}; -bodyBillingAddress.addressLine1 = '500 Electric Ave'; -bodyBillingAddress.addressLine2 = 'Suite 600'; -bodyBillingAddress.locality = 'New York'; -bodyBillingAddress.administrativeDistrictLevel1 = 'NY'; -bodyBillingAddress.postalCode = '10003'; -bodyBillingAddress.country = 'US'; const body: CreateCustomerCardRequest = { cardNonce: 'YOUR_CARD_NONCE', + billingAddress: { + addressLine1: '500 Electric Ave', + addressLine2: 'Suite 600', + locality: 'New York', + administrativeDistrictLevel1: 'NY', + postalCode: '10003', + country: 'US', + }, + cardholderName: 'Amelia Earhart', }; -body.billingAddress = bodyBillingAddress; -body.cardholderName = 'Amelia Earhart'; try { - const { result, ...httpResponse } = await customersApi.createCustomerCard(customerId, body); + const { result, ...httpResponse } = await customersApi.createCustomerCard( + customerId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -450,12 +452,17 @@ async deleteCustomerCard( ```ts const customerId = 'customer_id8'; + const cardId = 'card_id4'; + try { - const { result, ...httpResponse } = await customersApi.deleteCustomerCard(customerId, cardId); + const { result, ...httpResponse } = await customersApi.deleteCustomerCard( + customerId, + cardId + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -495,12 +502,17 @@ async removeGroupFromCustomer( ```ts const customerId = 'customer_id8'; + const groupId = 'group_id0'; + try { - const { result, ...httpResponse } = await customersApi.removeGroupFromCustomer(customerId, groupId); + const { result, ...httpResponse } = await customersApi.removeGroupFromCustomer( + customerId, + groupId + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -540,12 +552,17 @@ async addGroupToCustomer( ```ts const customerId = 'customer_id8'; + const groupId = 'group_id0'; + try { - const { result, ...httpResponse } = await customersApi.addGroupToCustomer(customerId, groupId); + const { result, ...httpResponse } = await customersApi.addGroupToCustomer( + customerId, + groupId + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/devices.md b/doc/api/devices.md index b1e1162c..f25772cb 100644 --- a/doc/api/devices.md +++ b/doc/api/devices.md @@ -50,7 +50,7 @@ try { const { result, ...httpResponse } = await devicesApi.listDeviceCodes(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -85,23 +85,20 @@ async createDeviceCode( ## Example Usage ```ts -const contentType = null; -const bodyDeviceCode: DeviceCode = { - productType: 'TERMINAL_API', -}; -bodyDeviceCode.name = 'Counter 1'; -bodyDeviceCode.locationId = 'B5E4484SHHNYH'; - const body: CreateDeviceCodeRequest = { idempotencyKey: '01bb00a6-0c86-4770-94ed-f5fca973cd56', - deviceCode: bodyDeviceCode, + deviceCode: { + productType: 'TERMINAL_API', + name: 'Counter 1', + locationId: 'B5E4484SHHNYH', + }, }; try { const { result, ...httpResponse } = await devicesApi.createDeviceCode(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -136,11 +133,12 @@ async getDeviceCode( ```ts const id = 'id0'; + try { const { result, ...httpResponse } = await devicesApi.getDeviceCode(id); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/disputes.md b/doc/api/disputes.md index 17c4c66f..dc0ca7f6 100644 --- a/doc/api/disputes.md +++ b/doc/api/disputes.md @@ -54,7 +54,7 @@ try { const { result, ...httpResponse } = await disputesApi.listDisputes(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -89,11 +89,12 @@ async retrieveDispute( ```ts const disputeId = 'dispute_id2'; + try { const { result, ...httpResponse } = await disputesApi.retrieveDispute(disputeId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -132,11 +133,12 @@ async acceptDispute( ```ts const disputeId = 'dispute_id2'; + try { const { result, ...httpResponse } = await disputesApi.acceptDispute(disputeId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -173,11 +175,12 @@ async listDisputeEvidence( ```ts const disputeId = 'dispute_id2'; + try { const { result, ...httpResponse } = await disputesApi.listDisputeEvidence(disputeId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -217,11 +220,12 @@ async createDisputeEvidenceFile( ```ts const disputeId = 'dispute_id2'; + try { const { result, ...httpResponse } = await disputesApi.createDisputeEvidenceFile(disputeId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -258,18 +262,21 @@ async createDisputeEvidenceText( ```ts const disputeId = 'dispute_id2'; -const contentType = null; + const body: CreateDisputeEvidenceTextRequest = { idempotencyKey: 'ed3ee3933d946f1514d505d173c82648', evidenceText: '1Z8888888888888888', + evidenceType: 'TRACKING_NUMBER', }; -body.evidenceType = 'TRACKING_NUMBER'; try { - const { result, ...httpResponse } = await disputesApi.createDisputeEvidenceText(disputeId, body); + const { result, ...httpResponse } = await disputesApi.createDisputeEvidenceText( + disputeId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -307,12 +314,17 @@ async deleteDisputeEvidence( ```ts const disputeId = 'dispute_id2'; + const evidenceId = 'evidence_id2'; + try { - const { result, ...httpResponse } = await disputesApi.deleteDisputeEvidence(disputeId, evidenceId); + const { result, ...httpResponse } = await disputesApi.deleteDisputeEvidence( + disputeId, + evidenceId + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -351,12 +363,17 @@ async retrieveDisputeEvidence( ```ts const disputeId = 'dispute_id2'; + const evidenceId = 'evidence_id2'; + try { - const { result, ...httpResponse } = await disputesApi.retrieveDisputeEvidence(disputeId, evidenceId); + const { result, ...httpResponse } = await disputesApi.retrieveDisputeEvidence( + disputeId, + evidenceId + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -397,11 +414,12 @@ async submitEvidence( ```ts const disputeId = 'dispute_id2'; + try { const { result, ...httpResponse } = await disputesApi.submitEvidence(disputeId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/employees.md b/doc/api/employees.md index 33e73892..36048f65 100644 --- a/doc/api/employees.md +++ b/doc/api/employees.md @@ -51,7 +51,7 @@ try { const { result, ...httpResponse } = await employeesApi.listEmployees(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -88,11 +88,12 @@ async retrieveEmployee( ```ts const id = 'id0'; + try { const { result, ...httpResponse } = await employeesApi.retrieveEmployee(id); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/gift-card-activities.md b/doc/api/gift-card-activities.md index b4aa4b8f..6054513a 100644 --- a/doc/api/gift-card-activities.md +++ b/doc/api/gift-card-activities.md @@ -60,7 +60,7 @@ try { const { result, ...httpResponse } = await giftCardActivitiesApi.listGiftCardActivities(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -96,28 +96,24 @@ async createGiftCardActivity( ## Example Usage ```ts -const contentType = null; -const bodyGiftCardActivityActivateActivityDetails: GiftCardActivityActivate = {}; -bodyGiftCardActivityActivateActivityDetails.orderId = 'jJNGHm4gLI6XkFbwtiSLqK72KkAZY'; -bodyGiftCardActivityActivateActivityDetails.lineItemUid = 'eIWl7X0nMuO9Ewbh0ChIx'; - -const bodyGiftCardActivity: GiftCardActivity = { - type: 'ACTIVATE', - locationId: '81FN9BNFZTKS4', -}; -bodyGiftCardActivity.giftCardId = 'gftc:6d55a72470d940c6ba09c0ab8ad08d20'; -bodyGiftCardActivity.activateActivityDetails = bodyGiftCardActivityActivateActivityDetails; - const body: CreateGiftCardActivityRequest = { idempotencyKey: 'U16kfr-kA70er-q4Rsym-7U7NnY', - giftCardActivity: bodyGiftCardActivity, + giftCardActivity: { + type: 'ACTIVATE', + locationId: '81FN9BNFZTKS4', + giftCardId: 'gftc:6d55a72470d940c6ba09c0ab8ad08d20', + activateActivityDetails: { + orderId: 'jJNGHm4gLI6XkFbwtiSLqK72KkAZY', + lineItemUid: 'eIWl7X0nMuO9Ewbh0ChIx', + }, + }, }; try { const { result, ...httpResponse } = await giftCardActivitiesApi.createGiftCardActivity(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/gift-cards.md b/doc/api/gift-cards.md index 19d9fc6a..b9216c68 100644 --- a/doc/api/gift-cards.md +++ b/doc/api/gift-cards.md @@ -57,7 +57,7 @@ try { const { result, ...httpResponse } = await giftCardsApi.listGiftCards(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -93,22 +93,19 @@ async createGiftCard( ## Example Usage ```ts -const contentType = null; -const bodyGiftCard: GiftCard = { - type: 'DIGITAL', -}; - const body: CreateGiftCardRequest = { idempotencyKey: 'NC9Tm69EjbjtConu', locationId: '81FN9BNFZTKS4', - giftCard: bodyGiftCard, + giftCard: { + type: 'DIGITAL', + }, }; try { const { result, ...httpResponse } = await giftCardsApi.createGiftCard(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -142,7 +139,6 @@ async retrieveGiftCardFromGAN( ## Example Usage ```ts -const contentType = null; const body: RetrieveGiftCardFromGANRequest = { gan: '7783320001001635', }; @@ -151,7 +147,7 @@ try { const { result, ...httpResponse } = await giftCardsApi.retrieveGiftCardFromGAN(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -185,7 +181,6 @@ async retrieveGiftCardFromNonce( ## Example Usage ```ts -const contentType = null; const body: RetrieveGiftCardFromNonceRequest = { nonce: 'cnon:7783322135245171', }; @@ -194,7 +189,7 @@ try { const { result, ...httpResponse } = await giftCardsApi.retrieveGiftCardFromNonce(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -231,16 +226,19 @@ async linkCustomerToGiftCard( ```ts const giftCardId = 'gift_card_id8'; -const contentType = null; + const body: LinkCustomerToGiftCardRequest = { customerId: 'GKY0FZ3V717AH8Q2D821PNT2ZW', }; try { - const { result, ...httpResponse } = await giftCardsApi.linkCustomerToGiftCard(giftCardId, body); + const { result, ...httpResponse } = await giftCardsApi.linkCustomerToGiftCard( + giftCardId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -277,16 +275,19 @@ async unlinkCustomerFromGiftCard( ```ts const giftCardId = 'gift_card_id8'; -const contentType = null; + const body: UnlinkCustomerFromGiftCardRequest = { customerId: 'GKY0FZ3V717AH8Q2D821PNT2ZW', }; try { - const { result, ...httpResponse } = await giftCardsApi.unlinkCustomerFromGiftCard(giftCardId, body); + const { result, ...httpResponse } = await giftCardsApi.unlinkCustomerFromGiftCard( + giftCardId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -321,11 +322,12 @@ async retrieveGiftCard( ```ts const id = 'id0'; + try { const { result, ...httpResponse } = await giftCardsApi.retrieveGiftCard(id); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/inventory.md b/doc/api/inventory.md index 474ddf51..28a58fe5 100644 --- a/doc/api/inventory.md +++ b/doc/api/inventory.md @@ -54,11 +54,12 @@ async deprecatedRetrieveInventoryAdjustment( ```ts const adjustmentId = 'adjustment_id0'; + try { const { result, ...httpResponse } = await inventoryApi.deprecatedRetrieveInventoryAdjustment(adjustmentId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -94,11 +95,12 @@ async retrieveInventoryAdjustment( ```ts const adjustmentId = 'adjustment_id0'; + try { const { result, ...httpResponse } = await inventoryApi.retrieveInventoryAdjustment(adjustmentId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -135,35 +137,30 @@ async deprecatedBatchChangeInventory( ## Example Usage ```ts -const contentType = null; -const bodyChanges: InventoryChange[] = []; - -const bodychanges0PhysicalCount: InventoryPhysicalCount = {}; -bodychanges0PhysicalCount.referenceId = '1536bfbf-efed-48bf-b17d-a197141b2a92'; -bodychanges0PhysicalCount.catalogObjectId = 'W62UWFY35CWMYGVWK6TWJDNI'; -bodychanges0PhysicalCount.state = 'IN_STOCK'; -bodychanges0PhysicalCount.locationId = 'C6W5YS5QM06F5'; -bodychanges0PhysicalCount.quantity = '53'; -bodychanges0PhysicalCount.teamMemberId = 'LRK57NSQ5X7PUD05'; -bodychanges0PhysicalCount.occurredAt = '2016-11-16T22:25:24.878Z'; - -const bodychanges0: InventoryChange = {}; -bodychanges0.type = 'PHYSICAL_COUNT'; -bodychanges0.physicalCount = bodychanges0PhysicalCount; - -bodyChanges[0] = bodychanges0; - const body: BatchChangeInventoryRequest = { idempotencyKey: '8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe', + changes: [ + { + type: 'PHYSICAL_COUNT', + physicalCount: { + referenceId: '1536bfbf-efed-48bf-b17d-a197141b2a92', + catalogObjectId: 'W62UWFY35CWMYGVWK6TWJDNI', + state: 'IN_STOCK', + locationId: 'C6W5YS5QM06F5', + quantity: '53', + teamMemberId: 'LRK57NSQ5X7PUD05', + occurredAt: '2016-11-16T22:25:24.878Z', + }, + } + ], + ignoreUnchangedCounts: true, }; -body.changes = bodyChanges; -body.ignoreUnchangedCounts = true; try { const { result, ...httpResponse } = await inventoryApi.deprecatedBatchChangeInventory(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -200,24 +197,28 @@ async deprecatedBatchRetrieveInventoryChanges( ## Example Usage ```ts -const contentType = null; -const bodyCatalogObjectIds: string[] = ['W62UWFY35CWMYGVWK6TWJDNI']; -const bodyLocationIds: string[] = ['C6W5YS5QM06F5']; -const bodyTypes: string[] = ['PHYSICAL_COUNT']; -const bodyStates: string[] = ['IN_STOCK']; -const body: BatchRetrieveInventoryChangesRequest = {}; -body.catalogObjectIds = bodyCatalogObjectIds; -body.locationIds = bodyLocationIds; -body.types = bodyTypes; -body.states = bodyStates; -body.updatedAfter = '2016-11-01T00:00:00Z'; -body.updatedBefore = '2016-12-01T00:00:00Z'; +const body: BatchRetrieveInventoryChangesRequest = { + catalogObjectIds: [ + 'W62UWFY35CWMYGVWK6TWJDNI' + ], + locationIds: [ + 'C6W5YS5QM06F5' + ], + types: [ + 'PHYSICAL_COUNT' + ], + states: [ + 'IN_STOCK' + ], + updatedAfter: '2016-11-01T00:00:00Z', + updatedBefore: '2016-12-01T00:00:00Z', +}; try { const { result, ...httpResponse } = await inventoryApi.deprecatedBatchRetrieveInventoryChanges(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -254,19 +255,21 @@ async deprecatedBatchRetrieveInventoryCounts( ## Example Usage ```ts -const contentType = null; -const bodyCatalogObjectIds: string[] = ['W62UWFY35CWMYGVWK6TWJDNI']; -const bodyLocationIds: string[] = ['59TNP9SA8VGDA']; -const body: BatchRetrieveInventoryCountsRequest = {}; -body.catalogObjectIds = bodyCatalogObjectIds; -body.locationIds = bodyLocationIds; -body.updatedAfter = '2016-11-16T00:00:00Z'; +const body: BatchRetrieveInventoryCountsRequest = { + catalogObjectIds: [ + 'W62UWFY35CWMYGVWK6TWJDNI' + ], + locationIds: [ + '59TNP9SA8VGDA' + ], + updatedAfter: '2016-11-16T00:00:00Z', +}; try { const { result, ...httpResponse } = await inventoryApi.deprecatedBatchRetrieveInventoryCounts(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -304,35 +307,30 @@ async batchChangeInventory( ## Example Usage ```ts -const contentType = null; -const bodyChanges: InventoryChange[] = []; - -const bodychanges0PhysicalCount: InventoryPhysicalCount = {}; -bodychanges0PhysicalCount.referenceId = '1536bfbf-efed-48bf-b17d-a197141b2a92'; -bodychanges0PhysicalCount.catalogObjectId = 'W62UWFY35CWMYGVWK6TWJDNI'; -bodychanges0PhysicalCount.state = 'IN_STOCK'; -bodychanges0PhysicalCount.locationId = 'C6W5YS5QM06F5'; -bodychanges0PhysicalCount.quantity = '53'; -bodychanges0PhysicalCount.teamMemberId = 'LRK57NSQ5X7PUD05'; -bodychanges0PhysicalCount.occurredAt = '2016-11-16T22:25:24.878Z'; - -const bodychanges0: InventoryChange = {}; -bodychanges0.type = 'PHYSICAL_COUNT'; -bodychanges0.physicalCount = bodychanges0PhysicalCount; - -bodyChanges[0] = bodychanges0; - const body: BatchChangeInventoryRequest = { idempotencyKey: '8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe', + changes: [ + { + type: 'PHYSICAL_COUNT', + physicalCount: { + referenceId: '1536bfbf-efed-48bf-b17d-a197141b2a92', + catalogObjectId: 'W62UWFY35CWMYGVWK6TWJDNI', + state: 'IN_STOCK', + locationId: 'C6W5YS5QM06F5', + quantity: '53', + teamMemberId: 'LRK57NSQ5X7PUD05', + occurredAt: '2016-11-16T22:25:24.878Z', + }, + } + ], + ignoreUnchangedCounts: true, }; -body.changes = bodyChanges; -body.ignoreUnchangedCounts = true; try { const { result, ...httpResponse } = await inventoryApi.batchChangeInventory(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -373,24 +371,28 @@ async batchRetrieveInventoryChanges( ## Example Usage ```ts -const contentType = null; -const bodyCatalogObjectIds: string[] = ['W62UWFY35CWMYGVWK6TWJDNI']; -const bodyLocationIds: string[] = ['C6W5YS5QM06F5']; -const bodyTypes: string[] = ['PHYSICAL_COUNT']; -const bodyStates: string[] = ['IN_STOCK']; -const body: BatchRetrieveInventoryChangesRequest = {}; -body.catalogObjectIds = bodyCatalogObjectIds; -body.locationIds = bodyLocationIds; -body.types = bodyTypes; -body.states = bodyStates; -body.updatedAfter = '2016-11-01T00:00:00Z'; -body.updatedBefore = '2016-12-01T00:00:00Z'; +const body: BatchRetrieveInventoryChangesRequest = { + catalogObjectIds: [ + 'W62UWFY35CWMYGVWK6TWJDNI' + ], + locationIds: [ + 'C6W5YS5QM06F5' + ], + types: [ + 'PHYSICAL_COUNT' + ], + states: [ + 'IN_STOCK' + ], + updatedAfter: '2016-11-01T00:00:00Z', + updatedBefore: '2016-12-01T00:00:00Z', +}; try { const { result, ...httpResponse } = await inventoryApi.batchRetrieveInventoryChanges(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -434,19 +436,21 @@ async batchRetrieveInventoryCounts( ## Example Usage ```ts -const contentType = null; -const bodyCatalogObjectIds: string[] = ['W62UWFY35CWMYGVWK6TWJDNI']; -const bodyLocationIds: string[] = ['59TNP9SA8VGDA']; -const body: BatchRetrieveInventoryCountsRequest = {}; -body.catalogObjectIds = bodyCatalogObjectIds; -body.locationIds = bodyLocationIds; -body.updatedAfter = '2016-11-16T00:00:00Z'; +const body: BatchRetrieveInventoryCountsRequest = { + catalogObjectIds: [ + 'W62UWFY35CWMYGVWK6TWJDNI' + ], + locationIds: [ + '59TNP9SA8VGDA' + ], + updatedAfter: '2016-11-16T00:00:00Z', +}; try { const { result, ...httpResponse } = await inventoryApi.batchRetrieveInventoryCounts(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -484,11 +488,12 @@ async deprecatedRetrieveInventoryPhysicalCount( ```ts const physicalCountId = 'physical_count_id2'; + try { const { result, ...httpResponse } = await inventoryApi.deprecatedRetrieveInventoryPhysicalCount(physicalCountId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -524,11 +529,12 @@ async retrieveInventoryPhysicalCount( ```ts const physicalCountId = 'physical_count_id2'; + try { const { result, ...httpResponse } = await inventoryApi.retrieveInventoryPhysicalCount(physicalCountId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -564,11 +570,12 @@ async retrieveInventoryTransfer( ```ts const transferId = 'transfer_id6'; + try { const { result, ...httpResponse } = await inventoryApi.retrieveInventoryTransfer(transferId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -610,11 +617,12 @@ async retrieveInventoryCount( ```ts const catalogObjectId = 'catalog_object_id6'; + try { const { result, ...httpResponse } = await inventoryApi.retrieveInventoryCount(catalogObjectId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -667,11 +675,12 @@ async retrieveInventoryChanges( ```ts const catalogObjectId = 'catalog_object_id6'; + try { const { result, ...httpResponse } = await inventoryApi.retrieveInventoryChanges(catalogObjectId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/invoices.md b/doc/api/invoices.md index f23dc1c4..6b3f90a4 100644 --- a/doc/api/invoices.md +++ b/doc/api/invoices.md @@ -52,11 +52,12 @@ async listInvoices( ```ts const locationId = 'location_id4'; + try { const { result, ...httpResponse } = await invoicesApi.listInvoices(locationId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -94,76 +95,61 @@ async createInvoice( ## Example Usage ```ts -const contentType = null; -const bodyInvoicePrimaryRecipient: InvoiceRecipient = {}; -bodyInvoicePrimaryRecipient.customerId = 'JDKYHBWT1D4F8MFH63DBMEN8Y4'; - -const bodyInvoicePaymentRequests: InvoicePaymentRequest[] = []; - -const bodyInvoicepaymentRequests0Reminders: InvoicePaymentReminder[] = []; - -const bodyInvoicepaymentRequests0reminders0: InvoicePaymentReminder = {}; -bodyInvoicepaymentRequests0reminders0.relativeScheduledDays = -1; -bodyInvoicepaymentRequests0reminders0.message = 'Your invoice is due tomorrow'; - -bodyInvoicepaymentRequests0Reminders[0] = bodyInvoicepaymentRequests0reminders0; - -const bodyInvoicepaymentRequests0: InvoicePaymentRequest = {}; -bodyInvoicepaymentRequests0.requestType = 'BALANCE'; -bodyInvoicepaymentRequests0.dueDate = '2030-01-24'; -bodyInvoicepaymentRequests0.tippingEnabled = true; -bodyInvoicepaymentRequests0.automaticPaymentSource = 'NONE'; -bodyInvoicepaymentRequests0.reminders = bodyInvoicepaymentRequests0Reminders; - -bodyInvoicePaymentRequests[0] = bodyInvoicepaymentRequests0; - -const bodyInvoiceAcceptedPaymentMethods: InvoiceAcceptedPaymentMethods = {}; -bodyInvoiceAcceptedPaymentMethods.card = true; -bodyInvoiceAcceptedPaymentMethods.squareGiftCard = false; -bodyInvoiceAcceptedPaymentMethods.bankAccount = false; -bodyInvoiceAcceptedPaymentMethods.buyNowPayLater = false; - -const bodyInvoiceCustomFields: InvoiceCustomField[] = []; - -const bodyInvoicecustomFields0: InvoiceCustomField = {}; -bodyInvoicecustomFields0.label = 'Event Reference Number'; -bodyInvoicecustomFields0.value = 'Ref. #1234'; -bodyInvoicecustomFields0.placement = 'ABOVE_LINE_ITEMS'; - -bodyInvoiceCustomFields[0] = bodyInvoicecustomFields0; - -const bodyInvoicecustomFields1: InvoiceCustomField = {}; -bodyInvoicecustomFields1.label = 'Terms of Service'; -bodyInvoicecustomFields1.value = 'The terms of service are...'; -bodyInvoicecustomFields1.placement = 'BELOW_LINE_ITEMS'; - -bodyInvoiceCustomFields[1] = bodyInvoicecustomFields1; - -const bodyInvoice: Invoice = {}; -bodyInvoice.locationId = 'ES0RJRZYEC39A'; -bodyInvoice.orderId = 'CAISENgvlJ6jLWAzERDzjyHVybY'; -bodyInvoice.primaryRecipient = bodyInvoicePrimaryRecipient; -bodyInvoice.paymentRequests = bodyInvoicePaymentRequests; -bodyInvoice.deliveryMethod = 'EMAIL'; -bodyInvoice.invoiceNumber = 'inv-100'; -bodyInvoice.title = 'Event Planning Services'; -bodyInvoice.description = 'We appreciate your business!'; -bodyInvoice.scheduledAt = '2030-01-13T10:00:00Z'; -bodyInvoice.acceptedPaymentMethods = bodyInvoiceAcceptedPaymentMethods; -bodyInvoice.customFields = bodyInvoiceCustomFields; -bodyInvoice.saleOrServiceDate = '2030-01-24'; -bodyInvoice.storePaymentMethodEnabled = false; - const body: CreateInvoiceRequest = { - invoice: bodyInvoice, + invoice: { + locationId: 'ES0RJRZYEC39A', + orderId: 'CAISENgvlJ6jLWAzERDzjyHVybY', + primaryRecipient: { + customerId: 'JDKYHBWT1D4F8MFH63DBMEN8Y4', + }, + paymentRequests: [ + { + requestType: 'BALANCE', + dueDate: '2030-01-24', + tippingEnabled: true, + automaticPaymentSource: 'NONE', + reminders: [ + { + relativeScheduledDays: -1, + message: 'Your invoice is due tomorrow', + } + ], + } + ], + deliveryMethod: 'EMAIL', + invoiceNumber: 'inv-100', + title: 'Event Planning Services', + description: 'We appreciate your business!', + scheduledAt: '2030-01-13T10:00:00Z', + acceptedPaymentMethods: { + card: true, + squareGiftCard: false, + bankAccount: false, + buyNowPayLater: false, + }, + customFields: [ + { + label: 'Event Reference Number', + value: 'Ref. #1234', + placement: 'ABOVE_LINE_ITEMS', + }, + { + label: 'Terms of Service', + value: 'The terms of service are...', + placement: 'BELOW_LINE_ITEMS', + } + ], + saleOrServiceDate: '2030-01-24', + storePaymentMethodEnabled: false, + }, + idempotencyKey: 'ce3748f9-5fc1-4762-aa12-aae5e843f1f4', }; -body.idempotencyKey = 'ce3748f9-5fc1-4762-aa12-aae5e843f1f4'; try { const { result, ...httpResponse } = await invoicesApi.createInvoice(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -203,33 +189,28 @@ async searchInvoices( ## Example Usage ```ts -const contentType = null; -const bodyQueryFilterLocationIds: string[] = ['ES0RJRZYEC39A']; -const bodyQueryFilterCustomerIds: string[] = ['JDKYHBWT1D4F8MFH63DBMEN8Y4']; -const bodyQueryFilter: InvoiceFilter = { - locationIds: bodyQueryFilterLocationIds, -}; -bodyQueryFilter.customerIds = bodyQueryFilterCustomerIds; - -const bodyQuerySort: InvoiceSort = { - field: 'INVOICE_SORT_DATE', -}; -bodyQuerySort.order = 'DESC'; - -const bodyQuery: InvoiceQuery = { - filter: bodyQueryFilter, -}; -bodyQuery.sort = bodyQuerySort; - const body: SearchInvoicesRequest = { - query: bodyQuery, + query: { + filter: { + locationIds: [ + 'ES0RJRZYEC39A' + ], + customerIds: [ + 'JDKYHBWT1D4F8MFH63DBMEN8Y4' + ], + }, + sort: { + field: 'INVOICE_SORT_DATE', + order: 'DESC', + }, + }, }; try { const { result, ...httpResponse } = await invoicesApi.searchInvoices(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -268,11 +249,12 @@ async deleteInvoice( ```ts const invoiceId = 'invoice_id0'; + try { const { result, ...httpResponse } = await invoicesApi.deleteInvoice(invoiceId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -307,11 +289,12 @@ async getInvoice( ```ts const invoiceId = 'invoice_id0'; + try { const { result, ...httpResponse } = await invoicesApi.getInvoice(invoiceId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -351,31 +334,31 @@ async updateInvoice( ```ts const invoiceId = 'invoice_id0'; -const contentType = null; -const bodyInvoicePaymentRequests: InvoicePaymentRequest[] = []; - -const bodyInvoicepaymentRequests0: InvoicePaymentRequest = {}; -bodyInvoicepaymentRequests0.uid = '2da7964f-f3d2-4f43-81e8-5aa220bf3355'; -bodyInvoicepaymentRequests0.tippingEnabled = false; - -bodyInvoicePaymentRequests[0] = bodyInvoicepaymentRequests0; -const bodyInvoice: Invoice = {}; -bodyInvoice.version = 1; -bodyInvoice.paymentRequests = bodyInvoicePaymentRequests; - -const bodyFieldsToClear: string[] = ['payments_requests[2da7964f-f3d2-4f43-81e8-5aa220bf3355].reminders']; const body: UpdateInvoiceRequest = { - invoice: bodyInvoice, + invoice: { + version: 1, + paymentRequests: [ + { + uid: '2da7964f-f3d2-4f43-81e8-5aa220bf3355', + tippingEnabled: false, + } + ], + }, + idempotencyKey: '4ee82288-0910-499e-ab4c-5d0071dad1be', + fieldsToClear: [ + 'payments_requests[2da7964f-f3d2-4f43-81e8-5aa220bf3355].reminders' + ], }; -body.idempotencyKey = '4ee82288-0910-499e-ab4c-5d0071dad1be'; -body.fieldsToClear = bodyFieldsToClear; try { - const { result, ...httpResponse } = await invoicesApi.updateInvoice(invoiceId, body); + const { result, ...httpResponse } = await invoicesApi.updateInvoice( + invoiceId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -415,16 +398,19 @@ async cancelInvoice( ```ts const invoiceId = 'invoice_id0'; -const contentType = null; + const body: CancelInvoiceRequest = { version: 0, }; try { - const { result, ...httpResponse } = await invoicesApi.cancelInvoice(invoiceId, body); + const { result, ...httpResponse } = await invoicesApi.cancelInvoice( + invoiceId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -471,17 +457,20 @@ async publishInvoice( ```ts const invoiceId = 'invoice_id0'; -const contentType = null; + const body: PublishInvoiceRequest = { version: 1, + idempotencyKey: '32da42d0-1997-41b0-826b-f09464fc2c2e', }; -body.idempotencyKey = '32da42d0-1997-41b0-826b-f09464fc2c2e'; try { - const { result, ...httpResponse } = await invoicesApi.publishInvoice(invoiceId, body); + const { result, ...httpResponse } = await invoicesApi.publishInvoice( + invoiceId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/labor.md b/doc/api/labor.md index bece6fc5..65db4742 100644 --- a/doc/api/labor.md +++ b/doc/api/labor.md @@ -61,7 +61,7 @@ try { const { result, ...httpResponse } = await laborApi.listBreakTypes(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -108,24 +108,21 @@ async createBreakType( ## Example Usage ```ts -const contentType = null; -const bodyBreakType: BreakType = { - locationId: 'CGJN03P1D08GF', - breakName: 'Lunch Break', - expectedDuration: 'PT30M', - isPaid: true, -}; - const body: CreateBreakTypeRequest = { - breakType: bodyBreakType, + breakType: { + locationId: 'CGJN03P1D08GF', + breakName: 'Lunch Break', + expectedDuration: 'PT30M', + isPaid: true, + }, + idempotencyKey: 'PAD3NG5KSN2GL', }; -body.idempotencyKey = 'PAD3NG5KSN2GL'; try { const { result, ...httpResponse } = await laborApi.createBreakType(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -162,11 +159,12 @@ async deleteBreakType( ```ts const id = 'id0'; + try { const { result, ...httpResponse } = await laborApi.deleteBreakType(id); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -201,11 +199,12 @@ async getBreakType( ```ts const id = 'id0'; + try { const { result, ...httpResponse } = await laborApi.getBreakType(id); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -242,24 +241,25 @@ async updateBreakType( ```ts const id = 'id0'; -const contentType = null; -const bodyBreakType: BreakType = { - locationId: '26M7H24AZ9N6R', - breakName: 'Lunch', - expectedDuration: 'PT50M', - isPaid: true, -}; -bodyBreakType.version = 1; const body: UpdateBreakTypeRequest = { - breakType: bodyBreakType, + breakType: { + locationId: '26M7H24AZ9N6R', + breakName: 'Lunch', + expectedDuration: 'PT50M', + isPaid: true, + version: 1, + }, }; try { - const { result, ...httpResponse } = await laborApi.updateBreakType(id, body); + const { result, ...httpResponse } = await laborApi.updateBreakType( + id, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -303,7 +303,7 @@ try { const { result, ...httpResponse } = await laborApi.listEmployeeWages(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -340,11 +340,12 @@ async getEmployeeWage( ```ts const id = 'id0'; + try { const { result, ...httpResponse } = await laborApi.getEmployeeWage(id); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -396,47 +397,38 @@ async createShift( ## Example Usage ```ts -const contentType = null; -const bodyShiftWageHourlyRate: Money = {}; -bodyShiftWageHourlyRate.amount = BigInt(1100); -bodyShiftWageHourlyRate.currency = 'USD'; - -const bodyShiftWage: ShiftWage = {}; -bodyShiftWage.title = 'Barista'; -bodyShiftWage.hourlyRate = bodyShiftWageHourlyRate; - -const bodyShiftBreaks: Break[] = []; - -const bodyShiftbreaks0: Break = { - startAt: '2019-01-25T11:11:00+00:00', - breakTypeId: 'REGS1EQR1TPZ5', - name: 'Tea Break', - expectedDuration: 'PT5M', - isPaid: true, -}; -bodyShiftbreaks0.endAt = '2019-01-25T11:16:00+00:00'; - -bodyShiftBreaks[0] = bodyShiftbreaks0; - -const bodyShift: Shift = { - startAt: '2019-01-25T08:11:00+00:00', -}; -bodyShift.locationId = 'PAA1RJZZKXBFG'; -bodyShift.endAt = '2019-01-25T18:11:00+00:00'; -bodyShift.wage = bodyShiftWage; -bodyShift.breaks = bodyShiftBreaks; -bodyShift.teamMemberId = 'ormj0jJJZ5OZIzxrZYJI'; - const body: CreateShiftRequest = { - shift: bodyShift, + shift: { + startAt: '2019-01-25T08:11:00+00:00', + locationId: 'PAA1RJZZKXBFG', + endAt: '2019-01-25T18:11:00+00:00', + wage: { + title: 'Barista', + hourlyRate: { + amount: BigInt(1100), + currency: 'USD', + }, + }, + breaks: [ + { + startAt: '2019-01-25T11:11:00+00:00', + breakTypeId: 'REGS1EQR1TPZ5', + name: 'Tea Break', + expectedDuration: 'PT5M', + isPaid: true, + endAt: '2019-01-25T11:16:00+00:00', + } + ], + teamMemberId: 'ormj0jJJZ5OZIzxrZYJI', + }, + idempotencyKey: 'HIDSNG5KS478L', }; -body.idempotencyKey = 'HIDSNG5KS478L'; try { const { result, ...httpResponse } = await laborApi.createShift(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -485,31 +477,27 @@ async searchShifts( ## Example Usage ```ts -const contentType = null; -const bodyQueryFilterWorkdayDateRange: DateRange = {}; -bodyQueryFilterWorkdayDateRange.startDate = '2019-01-20'; -bodyQueryFilterWorkdayDateRange.endDate = '2019-02-03'; - -const bodyQueryFilterWorkday: ShiftWorkday = {}; -bodyQueryFilterWorkday.dateRange = bodyQueryFilterWorkdayDateRange; -bodyQueryFilterWorkday.matchShiftsBy = 'START_AT'; -bodyQueryFilterWorkday.defaultTimezone = 'America/Los_Angeles'; - -const bodyQueryFilter: ShiftFilter = {}; -bodyQueryFilter.workday = bodyQueryFilterWorkday; - -const bodyQuery: ShiftQuery = {}; -bodyQuery.filter = bodyQueryFilter; - -const body: SearchShiftsRequest = {}; -body.query = bodyQuery; -body.limit = 100; +const body: SearchShiftsRequest = { + query: { + filter: { + workday: { + dateRange: { + startDate: '2019-01-20', + endDate: '2019-02-03', + }, + matchShiftsBy: 'START_AT', + defaultTimezone: 'America/Los_Angeles', + }, + }, + }, + limit: 100, +}; try { const { result, ...httpResponse } = await laborApi.searchShifts(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -544,11 +532,12 @@ async deleteShift( ```ts const id = 'id0'; + try { const { result, ...httpResponse } = await laborApi.deleteShift(id); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -583,11 +572,12 @@ async getShift( ```ts const id = 'id0'; + try { const { result, ...httpResponse } = await laborApi.getShift(id); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -630,48 +620,43 @@ async updateShift( ```ts const id = 'id0'; -const contentType = null; -const bodyShiftWageHourlyRate: Money = {}; -bodyShiftWageHourlyRate.amount = BigInt(1500); -bodyShiftWageHourlyRate.currency = 'USD'; - -const bodyShiftWage: ShiftWage = {}; -bodyShiftWage.title = 'Bartender'; -bodyShiftWage.hourlyRate = bodyShiftWageHourlyRate; - -const bodyShiftBreaks: Break[] = []; - -const bodyShiftbreaks0: Break = { - startAt: '2019-01-25T11:11:00+00:00', - breakTypeId: 'REGS1EQR1TPZ5', - name: 'Tea Break', - expectedDuration: 'PT5M', - isPaid: true, -}; -bodyShiftbreaks0.id = 'X7GAQYVVRRG6P'; -bodyShiftbreaks0.endAt = '2019-01-25T11:16:00+00:00'; - -bodyShiftBreaks[0] = bodyShiftbreaks0; - -const bodyShift: Shift = { - startAt: '2019-01-25T08:11:00+00:00', -}; -bodyShift.locationId = 'PAA1RJZZKXBFG'; -bodyShift.endAt = '2019-01-25T18:11:00+00:00'; -bodyShift.wage = bodyShiftWage; -bodyShift.breaks = bodyShiftBreaks; -bodyShift.version = 1; -bodyShift.teamMemberId = 'ormj0jJJZ5OZIzxrZYJI'; const body: UpdateShiftRequest = { - shift: bodyShift, + shift: { + startAt: '2019-01-25T08:11:00+00:00', + locationId: 'PAA1RJZZKXBFG', + endAt: '2019-01-25T18:11:00+00:00', + wage: { + title: 'Bartender', + hourlyRate: { + amount: BigInt(1500), + currency: 'USD', + }, + }, + breaks: [ + { + startAt: '2019-01-25T11:11:00+00:00', + breakTypeId: 'REGS1EQR1TPZ5', + name: 'Tea Break', + expectedDuration: 'PT5M', + isPaid: true, + id: 'X7GAQYVVRRG6P', + endAt: '2019-01-25T11:16:00+00:00', + } + ], + version: 1, + teamMemberId: 'ormj0jJJZ5OZIzxrZYJI', + }, }; try { - const { result, ...httpResponse } = await laborApi.updateShift(id, body); + const { result, ...httpResponse } = await laborApi.updateShift( + id, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -713,7 +698,7 @@ try { const { result, ...httpResponse } = await laborApi.listTeamMemberWages(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -748,11 +733,12 @@ async getTeamMemberWage( ```ts const id = 'id0'; + try { const { result, ...httpResponse } = await laborApi.getTeamMemberWage(id); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -792,7 +778,7 @@ try { const { result, ...httpResponse } = await laborApi.listWorkweekConfigs(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -829,22 +815,23 @@ async updateWorkweekConfig( ```ts const id = 'id0'; -const contentType = null; -const bodyWorkweekConfig: WorkweekConfig = { - startOfWeek: 'MON', - startOfDayLocalTime: '10:00', -}; -bodyWorkweekConfig.version = 10; const body: UpdateWorkweekConfigRequest = { - workweekConfig: bodyWorkweekConfig, + workweekConfig: { + startOfWeek: 'MON', + startOfDayLocalTime: '10:00', + version: 10, + }, }; try { - const { result, ...httpResponse } = await laborApi.updateWorkweekConfig(id, body); + const { result, ...httpResponse } = await laborApi.updateWorkweekConfig( + id, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/location-custom-attributes.md b/doc/api/location-custom-attributes.md index 4633265f..dc3c6989 100644 --- a/doc/api/location-custom-attributes.md +++ b/doc/api/location-custom-attributes.md @@ -59,7 +59,7 @@ try { const { result, ...httpResponse } = await locationCustomAttributesApi.listLocationCustomAttributeDefinitions(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -99,22 +99,20 @@ async createLocationCustomAttributeDefinition( ## Example Usage ```ts -const contentType = null; -const bodyCustomAttributeDefinition: CustomAttributeDefinition = {}; -bodyCustomAttributeDefinition.key = 'bestseller'; -bodyCustomAttributeDefinition.name = 'Bestseller'; -bodyCustomAttributeDefinition.description = 'Bestselling item at location'; -bodyCustomAttributeDefinition.visibility = 'VISIBILITY_READ_WRITE_VALUES'; - const body: CreateLocationCustomAttributeDefinitionRequest = { - customAttributeDefinition: bodyCustomAttributeDefinition, + customAttributeDefinition: { + key: 'bestseller', + name: 'Bestseller', + description: 'Bestselling item at location', + visibility: 'VISIBILITY_READ_WRITE_VALUES', + }, }; try { const { result, ...httpResponse } = await locationCustomAttributesApi.createLocationCustomAttributeDefinition(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -152,11 +150,12 @@ async deleteLocationCustomAttributeDefinition( ```ts const key = 'key0'; + try { const { result, ...httpResponse } = await locationCustomAttributesApi.deleteLocationCustomAttributeDefinition(key); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -195,11 +194,12 @@ async retrieveLocationCustomAttributeDefinition( ```ts const key = 'key0'; + try { const { result, ...httpResponse } = await locationCustomAttributesApi.retrieveLocationCustomAttributeDefinition(key); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -239,20 +239,22 @@ async updateLocationCustomAttributeDefinition( ```ts const key = 'key0'; -const contentType = null; -const bodyCustomAttributeDefinition: CustomAttributeDefinition = {}; -bodyCustomAttributeDefinition.description = 'Update the description as desired.'; -bodyCustomAttributeDefinition.visibility = 'VISIBILITY_READ_ONLY'; const body: UpdateLocationCustomAttributeDefinitionRequest = { - customAttributeDefinition: bodyCustomAttributeDefinition, + customAttributeDefinition: { + description: 'Update the description as desired.', + visibility: 'VISIBILITY_READ_ONLY', + }, }; try { - const { result, ...httpResponse } = await locationCustomAttributesApi.updateLocationCustomAttributeDefinition(key, body); + const { result, ...httpResponse } = await locationCustomAttributesApi.updateLocationCustomAttributeDefinition( + key, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -288,17 +290,19 @@ async bulkDeleteLocationCustomAttributes( ## Example Usage ```ts -const contentType = null; -const bodyValues: Record = {}; const body: BulkDeleteLocationCustomAttributesRequest = { - values: bodyValues, + values: { + 'id1': {}, + 'id2': {}, + 'id3': {} + }, }; try { const { result, ...httpResponse } = await locationCustomAttributesApi.bulkDeleteLocationCustomAttributes(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -341,17 +345,24 @@ async bulkUpsertLocationCustomAttributes( ## Example Usage ```ts -const contentType = null; -const bodyValues: Record = {}; const body: BulkUpsertLocationCustomAttributesRequest = { - values: bodyValues, + values: { + 'key0': { + locationId: 'location_id8', + customAttribute: {}, + }, + 'key1': { + locationId: 'location_id9', + customAttribute: {}, + } + }, }; try { const { result, ...httpResponse } = await locationCustomAttributesApi.bulkUpsertLocationCustomAttributes(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -399,12 +410,17 @@ async listLocationCustomAttributes( ```ts const locationId = 'location_id4'; + const withDefinitions = false; + try { - const { result, ...httpResponse } = await locationCustomAttributesApi.listLocationCustomAttributes(locationId, None, None, None, withDefinitions); + const { result, ...httpResponse } = await locationCustomAttributesApi.listLocationCustomAttributes( + locationId, + withDefinitions + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -443,12 +459,17 @@ async deleteLocationCustomAttribute( ```ts const locationId = 'location_id4'; + const key = 'key0'; + try { - const { result, ...httpResponse } = await locationCustomAttributesApi.deleteLocationCustomAttribute(locationId, key); + const { result, ...httpResponse } = await locationCustomAttributesApi.deleteLocationCustomAttribute( + locationId, + key + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -493,13 +514,20 @@ async retrieveLocationCustomAttribute( ```ts const locationId = 'location_id4'; + const key = 'key0'; + const withDefinition = false; + try { - const { result, ...httpResponse } = await locationCustomAttributesApi.retrieveLocationCustomAttribute(locationId, key, withDefinition); + const { result, ...httpResponse } = await locationCustomAttributesApi.retrieveLocationCustomAttribute( + locationId, + key, + withDefinition + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -543,19 +571,22 @@ async upsertLocationCustomAttribute( ```ts const locationId = 'location_id4'; + const key = 'key0'; -const contentType = null; -const bodyCustomAttribute: CustomAttribute = {}; const body: UpsertLocationCustomAttributeRequest = { - customAttribute: bodyCustomAttribute, + customAttribute: {}, }; try { - const { result, ...httpResponse } = await locationCustomAttributesApi.upsertLocationCustomAttribute(locationId, key, body); + const { result, ...httpResponse } = await locationCustomAttributesApi.upsertLocationCustomAttribute( + locationId, + key, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/locations.md b/doc/api/locations.md index df187382..433667ca 100644 --- a/doc/api/locations.md +++ b/doc/api/locations.md @@ -44,7 +44,7 @@ try { const { result, ...httpResponse } = await locationsApi.listLocations(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -84,26 +84,24 @@ async createLocation( ## Example Usage ```ts -const contentType = null; -const bodyLocationAddress: Address = {}; -bodyLocationAddress.addressLine1 = '1234 Peachtree St. NE'; -bodyLocationAddress.locality = 'Atlanta'; -bodyLocationAddress.administrativeDistrictLevel1 = 'GA'; -bodyLocationAddress.postalCode = '30309'; - -const bodyLocation: Location = {}; -bodyLocation.name = 'Midtown'; -bodyLocation.address = bodyLocationAddress; -bodyLocation.description = 'Midtown Atlanta store'; - -const body: CreateLocationRequest = {}; -body.location = bodyLocation; +const body: CreateLocationRequest = { + location: { + name: 'Midtown', + address: { + addressLine1: '1234 Peachtree St. NE', + locality: 'Atlanta', + administrativeDistrictLevel1: 'GA', + postalCode: '30309', + }, + description: 'Midtown Atlanta store', + }, +}; try { const { result, ...httpResponse } = await locationsApi.createLocation(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -139,11 +137,12 @@ async retrieveLocation( ```ts const locationId = 'location_id4'; + try { const { result, ...httpResponse } = await locationsApi.retrieveLocation(locationId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -180,45 +179,40 @@ async updateLocation( ```ts const locationId = 'location_id4'; -const contentType = null; -const bodyLocationBusinessHoursPeriods: BusinessHoursPeriod[] = []; - -const bodyLocationBusinessHoursperiods0: BusinessHoursPeriod = {}; -bodyLocationBusinessHoursperiods0.dayOfWeek = 'FRI'; -bodyLocationBusinessHoursperiods0.startLocalTime = '07:00'; -bodyLocationBusinessHoursperiods0.endLocalTime = '18:00'; - -bodyLocationBusinessHoursPeriods[0] = bodyLocationBusinessHoursperiods0; - -const bodyLocationBusinessHoursperiods1: BusinessHoursPeriod = {}; -bodyLocationBusinessHoursperiods1.dayOfWeek = 'SAT'; -bodyLocationBusinessHoursperiods1.startLocalTime = '07:00'; -bodyLocationBusinessHoursperiods1.endLocalTime = '18:00'; - -bodyLocationBusinessHoursPeriods[1] = bodyLocationBusinessHoursperiods1; - -const bodyLocationBusinessHoursperiods2: BusinessHoursPeriod = {}; -bodyLocationBusinessHoursperiods2.dayOfWeek = 'SUN'; -bodyLocationBusinessHoursperiods2.startLocalTime = '09:00'; -bodyLocationBusinessHoursperiods2.endLocalTime = '15:00'; - -bodyLocationBusinessHoursPeriods[2] = bodyLocationBusinessHoursperiods2; - -const bodyLocationBusinessHours: BusinessHours = {}; -bodyLocationBusinessHours.periods = bodyLocationBusinessHoursPeriods; - -const bodyLocation: Location = {}; -bodyLocation.businessHours = bodyLocationBusinessHours; -bodyLocation.description = 'Midtown Atlanta store - Open weekends'; -const body: UpdateLocationRequest = {}; -body.location = bodyLocation; +const body: UpdateLocationRequest = { + location: { + businessHours: { + periods: [ + { + dayOfWeek: 'FRI', + startLocalTime: '07:00', + endLocalTime: '18:00', + }, + { + dayOfWeek: 'SAT', + startLocalTime: '07:00', + endLocalTime: '18:00', + }, + { + dayOfWeek: 'SUN', + startLocalTime: '09:00', + endLocalTime: '15:00', + } + ], + }, + description: 'Midtown Atlanta store - Open weekends', + }, +}; try { - const { result, ...httpResponse } = await locationsApi.updateLocation(locationId, body); + const { result, ...httpResponse } = await locationsApi.updateLocation( + locationId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/loyalty.md b/doc/api/loyalty.md index 5e14a4b0..93a3178f 100644 --- a/doc/api/loyalty.md +++ b/doc/api/loyalty.md @@ -55,17 +55,13 @@ async createLoyaltyAccount( ## Example Usage ```ts -const contentType = null; -const bodyLoyaltyAccountMapping: LoyaltyAccountMapping = {}; -bodyLoyaltyAccountMapping.phoneNumber = '+14155551234'; - -const bodyLoyaltyAccount: LoyaltyAccount = { - programId: 'd619f755-2d17-41f3-990d-c04ecedd64dd', -}; -bodyLoyaltyAccount.mapping = bodyLoyaltyAccountMapping; - const body: CreateLoyaltyAccountRequest = { - loyaltyAccount: bodyLoyaltyAccount, + loyaltyAccount: { + programId: 'd619f755-2d17-41f3-990d-c04ecedd64dd', + mapping: { + phoneNumber: '+14155551234', + }, + }, idempotencyKey: 'ec78c477-b1c3-4899-a209-a4e71337c996', }; @@ -73,7 +69,7 @@ try { const { result, ...httpResponse } = await loyaltyApi.createLoyaltyAccount(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -111,26 +107,22 @@ async searchLoyaltyAccounts( ## Example Usage ```ts -const contentType = null; -const bodyQueryMappings: LoyaltyAccountMapping[] = []; - -const bodyQuerymappings0: LoyaltyAccountMapping = {}; -bodyQuerymappings0.phoneNumber = '+14155551234'; - -bodyQueryMappings[0] = bodyQuerymappings0; - -const bodyQuery: SearchLoyaltyAccountsRequestLoyaltyAccountQuery = {}; -bodyQuery.mappings = bodyQueryMappings; - -const body: SearchLoyaltyAccountsRequest = {}; -body.query = bodyQuery; -body.limit = 10; +const body: SearchLoyaltyAccountsRequest = { + query: { + mappings: [ + { + phoneNumber: '+14155551234', + } + ], + }, + limit: 10, +}; try { const { result, ...httpResponse } = await loyaltyApi.searchLoyaltyAccounts(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -165,11 +157,12 @@ async retrieveLoyaltyAccount( ```ts const accountId = 'account_id2'; + try { const { result, ...httpResponse } = await loyaltyApi.retrieveLoyaltyAccount(accountId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -219,21 +212,23 @@ async accumulateLoyaltyPoints( ```ts const accountId = 'account_id2'; -const contentType = null; -const bodyAccumulatePoints: LoyaltyEventAccumulatePoints = {}; -bodyAccumulatePoints.orderId = 'RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY'; const body: AccumulateLoyaltyPointsRequest = { - accumulatePoints: bodyAccumulatePoints, + accumulatePoints: { + orderId: 'RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY', + }, idempotencyKey: '58b90739-c3e8-4b11-85f7-e636d48d72cb', locationId: 'P034NEENMD09F', }; try { - const { result, ...httpResponse } = await loyaltyApi.accumulateLoyaltyPoints(accountId, body); + const { result, ...httpResponse } = await loyaltyApi.accumulateLoyaltyPoints( + accountId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -274,22 +269,23 @@ async adjustLoyaltyPoints( ```ts const accountId = 'account_id2'; -const contentType = null; -const bodyAdjustPoints: LoyaltyEventAdjustPoints = { - points: 10, -}; -bodyAdjustPoints.reason = 'Complimentary points'; const body: AdjustLoyaltyPointsRequest = { idempotencyKey: 'bc29a517-3dc9-450e-aa76-fae39ee849d1', - adjustPoints: bodyAdjustPoints, + adjustPoints: { + points: 10, + reason: 'Complimentary points', + }, }; try { - const { result, ...httpResponse } = await loyaltyApi.adjustLoyaltyPoints(accountId, body); + const { result, ...httpResponse } = await loyaltyApi.adjustLoyaltyPoints( + accountId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -330,26 +326,22 @@ async searchLoyaltyEvents( ## Example Usage ```ts -const contentType = null; -const bodyQueryFilterOrderFilter: LoyaltyEventOrderFilter = { - orderId: 'PyATxhYLfsMqpVkcKJITPydgEYfZY', +const body: SearchLoyaltyEventsRequest = { + query: { + filter: { + orderFilter: { + orderId: 'PyATxhYLfsMqpVkcKJITPydgEYfZY', + }, + }, + }, + limit: 30, }; -const bodyQueryFilter: LoyaltyEventFilter = {}; -bodyQueryFilter.orderFilter = bodyQueryFilterOrderFilter; - -const bodyQuery: LoyaltyEventQuery = {}; -bodyQuery.filter = bodyQueryFilter; - -const body: SearchLoyaltyEventsRequest = {}; -body.query = bodyQuery; -body.limit = 30; - try { const { result, ...httpResponse } = await loyaltyApi.searchLoyaltyEvents(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -390,7 +382,7 @@ try { const { result, ...httpResponse } = await loyaltyApi.listLoyaltyPrograms(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -427,11 +419,12 @@ async retrieveLoyaltyProgram( ```ts const programId = 'program_id0'; + try { const { result, ...httpResponse } = await loyaltyApi.retrieveLoyaltyProgram(programId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -482,16 +475,20 @@ async calculateLoyaltyPoints( ```ts const programId = 'program_id0'; -const contentType = null; -const body: CalculateLoyaltyPointsRequest = {}; -body.orderId = 'RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY'; -body.loyaltyAccountId = '79b807d2-d786-46a9-933b-918028d7a8c5'; + +const body: CalculateLoyaltyPointsRequest = { + orderId: 'RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY', + loyaltyAccountId: '79b807d2-d786-46a9-933b-918028d7a8c5', +}; try { - const { result, ...httpResponse } = await loyaltyApi.calculateLoyaltyPoints(programId, body); + const { result, ...httpResponse } = await loyaltyApi.calculateLoyaltyPoints( + programId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -533,11 +530,12 @@ async listLoyaltyPromotions( ```ts const programId = 'program_id0'; + try { const { result, ...httpResponse } = await loyaltyApi.listLoyaltyPromotions(programId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -579,50 +577,44 @@ async createLoyaltyPromotion( ```ts const programId = 'program_id0'; -const contentType = null; -const bodyLoyaltyPromotionIncentivePointsMultiplierData: LoyaltyPromotionIncentivePointsMultiplierData = { - pointsMultiplier: 3, -}; - -const bodyLoyaltyPromotionIncentive: LoyaltyPromotionIncentive = { - type: 'POINTS_MULTIPLIER', -}; -bodyLoyaltyPromotionIncentive.pointsMultiplierData = bodyLoyaltyPromotionIncentivePointsMultiplierData; - -const bodyLoyaltyPromotionAvailableTimeTimePeriods: string[] = ['BEGIN:VEVENT\nDTSTART:20220816T160000\nDURATION:PT2H\nRRULE:FREQ=WEEKLY;BYDAY=TU\nEND:VEVENT']; -const bodyLoyaltyPromotionAvailableTime: LoyaltyPromotionAvailableTimeData = { - timePeriods: bodyLoyaltyPromotionAvailableTimeTimePeriods, -}; - -const bodyLoyaltyPromotionTriggerLimit: LoyaltyPromotionTriggerLimit = { - times: 1, -}; -bodyLoyaltyPromotionTriggerLimit.interval = 'DAY'; - -const bodyLoyaltyPromotionMinimumSpendAmountMoney: Money = {}; -bodyLoyaltyPromotionMinimumSpendAmountMoney.amount = BigInt(2000); -bodyLoyaltyPromotionMinimumSpendAmountMoney.currency = 'USD'; - -const bodyLoyaltyPromotionQualifyingCategoryIds: string[] = ['XTQPYLR3IIU9C44VRCB3XD12']; -const bodyLoyaltyPromotion: LoyaltyPromotion = { - name: 'Tuesday Happy Hour Promo', - incentive: bodyLoyaltyPromotionIncentive, - availableTime: bodyLoyaltyPromotionAvailableTime, -}; -bodyLoyaltyPromotion.triggerLimit = bodyLoyaltyPromotionTriggerLimit; -bodyLoyaltyPromotion.minimumSpendAmountMoney = bodyLoyaltyPromotionMinimumSpendAmountMoney; -bodyLoyaltyPromotion.qualifyingCategoryIds = bodyLoyaltyPromotionQualifyingCategoryIds; const body: CreateLoyaltyPromotionRequest = { - loyaltyPromotion: bodyLoyaltyPromotion, + loyaltyPromotion: { + name: 'Tuesday Happy Hour Promo', + incentive: { + type: 'POINTS_MULTIPLIER', + pointsMultiplierData: { + pointsMultiplier: 3, + }, + }, + availableTime: { + timePeriods: [ + 'BEGIN:VEVENT\nDTSTART:20220816T160000\nDURATION:PT2H\nRRULE:FREQ=WEEKLY;BYDAY=TU\nEND:VEVENT' + ], + }, + triggerLimit: { + times: 1, + interval: 'DAY', + }, + minimumSpendAmountMoney: { + amount: BigInt(2000), + currency: 'USD', + }, + qualifyingCategoryIds: [ + 'XTQPYLR3IIU9C44VRCB3XD12' + ], + }, idempotencyKey: 'ec78c477-b1c3-4899-a209-a4e71337c996', }; try { - const { result, ...httpResponse } = await loyaltyApi.createLoyaltyPromotion(programId, body); + const { result, ...httpResponse } = await loyaltyApi.createLoyaltyPromotion( + programId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -659,12 +651,17 @@ async retrieveLoyaltyPromotion( ```ts const promotionId = 'promotion_id0'; + const programId = 'program_id0'; + try { - const { result, ...httpResponse } = await loyaltyApi.retrieveLoyaltyPromotion(promotionId, programId); + const { result, ...httpResponse } = await loyaltyApi.retrieveLoyaltyPromotion( + promotionId, + programId + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -706,12 +703,17 @@ async cancelLoyaltyPromotion( ```ts const promotionId = 'promotion_id0'; + const programId = 'program_id0'; + try { - const { result, ...httpResponse } = await loyaltyApi.cancelLoyaltyPromotion(promotionId, programId); + const { result, ...httpResponse } = await loyaltyApi.cancelLoyaltyPromotion( + promotionId, + programId + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -752,15 +754,12 @@ async createLoyaltyReward( ## Example Usage ```ts -const contentType = null; -const bodyReward: LoyaltyReward = { - loyaltyAccountId: '5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd', - rewardTierId: 'e1b39225-9da5-43d1-a5db-782cdd8ad94f', -}; -bodyReward.orderId = 'RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY'; - const body: CreateLoyaltyRewardRequest = { - reward: bodyReward, + reward: { + loyaltyAccountId: '5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd', + rewardTierId: 'e1b39225-9da5-43d1-a5db-782cdd8ad94f', + orderId: 'RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY', + }, idempotencyKey: '18c2e5ea-a620-4b1f-ad60-7b167285e451', }; @@ -768,7 +767,7 @@ try { const { result, ...httpResponse } = await loyaltyApi.createLoyaltyReward(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -808,20 +807,18 @@ async searchLoyaltyRewards( ## Example Usage ```ts -const contentType = null; -const bodyQuery: SearchLoyaltyRewardsRequestLoyaltyRewardQuery = { - loyaltyAccountId: '5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd', +const body: SearchLoyaltyRewardsRequest = { + query: { + loyaltyAccountId: '5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd', + }, + limit: 10, }; -const body: SearchLoyaltyRewardsRequest = {}; -body.query = bodyQuery; -body.limit = 10; - try { const { result, ...httpResponse } = await loyaltyApi.searchLoyaltyRewards(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -864,11 +861,12 @@ async deleteLoyaltyReward( ```ts const rewardId = 'reward_id4'; + try { const { result, ...httpResponse } = await loyaltyApi.deleteLoyaltyReward(rewardId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -903,11 +901,12 @@ async retrieveLoyaltyReward( ```ts const rewardId = 'reward_id4'; + try { const { result, ...httpResponse } = await loyaltyApi.retrieveLoyaltyReward(rewardId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -954,17 +953,20 @@ async redeemLoyaltyReward( ```ts const rewardId = 'reward_id4'; -const contentType = null; + const body: RedeemLoyaltyRewardRequest = { idempotencyKey: '98adc7f7-6963-473b-b29c-f3c9cdd7d994', locationId: 'P034NEENMD09F', }; try { - const { result, ...httpResponse } = await loyaltyApi.redeemLoyaltyReward(rewardId, body); + const { result, ...httpResponse } = await loyaltyApi.redeemLoyaltyReward( + rewardId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/merchant-custom-attributes.md b/doc/api/merchant-custom-attributes.md index f6005109..9853a9c7 100644 --- a/doc/api/merchant-custom-attributes.md +++ b/doc/api/merchant-custom-attributes.md @@ -59,7 +59,7 @@ try { const { result, ...httpResponse } = await merchantCustomAttributesApi.listMerchantCustomAttributeDefinitions(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -99,22 +99,20 @@ async createMerchantCustomAttributeDefinition( ## Example Usage ```ts -const contentType = null; -const bodyCustomAttributeDefinition: CustomAttributeDefinition = {}; -bodyCustomAttributeDefinition.key = 'alternative_seller_name'; -bodyCustomAttributeDefinition.name = 'Alternative Merchant Name'; -bodyCustomAttributeDefinition.description = 'This is the other name this merchant goes by.'; -bodyCustomAttributeDefinition.visibility = 'VISIBILITY_READ_ONLY'; - const body: CreateMerchantCustomAttributeDefinitionRequest = { - customAttributeDefinition: bodyCustomAttributeDefinition, + customAttributeDefinition: { + key: 'alternative_seller_name', + name: 'Alternative Merchant Name', + description: 'This is the other name this merchant goes by.', + visibility: 'VISIBILITY_READ_ONLY', + }, }; try { const { result, ...httpResponse } = await merchantCustomAttributesApi.createMerchantCustomAttributeDefinition(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -152,11 +150,12 @@ async deleteMerchantCustomAttributeDefinition( ```ts const key = 'key0'; + try { const { result, ...httpResponse } = await merchantCustomAttributesApi.deleteMerchantCustomAttributeDefinition(key); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -195,11 +194,12 @@ async retrieveMerchantCustomAttributeDefinition( ```ts const key = 'key0'; + try { const { result, ...httpResponse } = await merchantCustomAttributesApi.retrieveMerchantCustomAttributeDefinition(key); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -239,20 +239,22 @@ async updateMerchantCustomAttributeDefinition( ```ts const key = 'key0'; -const contentType = null; -const bodyCustomAttributeDefinition: CustomAttributeDefinition = {}; -bodyCustomAttributeDefinition.description = 'Update the description as desired.'; -bodyCustomAttributeDefinition.visibility = 'VISIBILITY_READ_ONLY'; const body: UpdateMerchantCustomAttributeDefinitionRequest = { - customAttributeDefinition: bodyCustomAttributeDefinition, + customAttributeDefinition: { + description: 'Update the description as desired.', + visibility: 'VISIBILITY_READ_ONLY', + }, }; try { - const { result, ...httpResponse } = await merchantCustomAttributesApi.updateMerchantCustomAttributeDefinition(key, body); + const { result, ...httpResponse } = await merchantCustomAttributesApi.updateMerchantCustomAttributeDefinition( + key, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -288,17 +290,18 @@ async bulkDeleteMerchantCustomAttributes( ## Example Usage ```ts -const contentType = null; -const bodyValues: Record = {}; const body: BulkDeleteMerchantCustomAttributesRequest = { - values: bodyValues, + values: { + 'id1': {}, + 'id2': {} + }, }; try { const { result, ...httpResponse } = await merchantCustomAttributesApi.bulkDeleteMerchantCustomAttributes(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -341,17 +344,24 @@ async bulkUpsertMerchantCustomAttributes( ## Example Usage ```ts -const contentType = null; -const bodyValues: Record = {}; const body: BulkUpsertMerchantCustomAttributesRequest = { - values: bodyValues, + values: { + 'key0': { + merchantId: 'merchant_id4', + customAttribute: {}, + }, + 'key1': { + merchantId: 'merchant_id5', + customAttribute: {}, + } + }, }; try { const { result, ...httpResponse } = await merchantCustomAttributesApi.bulkUpsertMerchantCustomAttributes(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -399,12 +409,17 @@ async listMerchantCustomAttributes( ```ts const merchantId = 'merchant_id0'; + const withDefinitions = false; + try { - const { result, ...httpResponse } = await merchantCustomAttributesApi.listMerchantCustomAttributes(merchantId, None, None, None, withDefinitions); + const { result, ...httpResponse } = await merchantCustomAttributesApi.listMerchantCustomAttributes( + merchantId, + withDefinitions + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -443,12 +458,17 @@ async deleteMerchantCustomAttribute( ```ts const merchantId = 'merchant_id0'; + const key = 'key0'; + try { - const { result, ...httpResponse } = await merchantCustomAttributesApi.deleteMerchantCustomAttribute(merchantId, key); + const { result, ...httpResponse } = await merchantCustomAttributesApi.deleteMerchantCustomAttribute( + merchantId, + key + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -493,13 +513,20 @@ async retrieveMerchantCustomAttribute( ```ts const merchantId = 'merchant_id0'; + const key = 'key0'; + const withDefinition = false; + try { - const { result, ...httpResponse } = await merchantCustomAttributesApi.retrieveMerchantCustomAttribute(merchantId, key, withDefinition); + const { result, ...httpResponse } = await merchantCustomAttributesApi.retrieveMerchantCustomAttribute( + merchantId, + key, + withDefinition + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -543,19 +570,22 @@ async upsertMerchantCustomAttribute( ```ts const merchantId = 'merchant_id0'; + const key = 'key0'; -const contentType = null; -const bodyCustomAttribute: CustomAttribute = {}; const body: UpsertMerchantCustomAttributeRequest = { - customAttribute: bodyCustomAttribute, + customAttribute: {}, }; try { - const { result, ...httpResponse } = await merchantCustomAttributesApi.upsertMerchantCustomAttribute(merchantId, key, body); + const { result, ...httpResponse } = await merchantCustomAttributesApi.upsertMerchantCustomAttribute( + merchantId, + key, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/merchants.md b/doc/api/merchants.md index bd9ecf50..e3d13e89 100644 --- a/doc/api/merchants.md +++ b/doc/api/merchants.md @@ -52,7 +52,7 @@ try { const { result, ...httpResponse } = await merchantsApi.listMerchants(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -87,11 +87,12 @@ async retrieveMerchant( ```ts const merchantId = 'merchant_id0'; + try { const { result, ...httpResponse } = await merchantsApi.retrieveMerchant(merchantId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/mobile-authorization.md b/doc/api/mobile-authorization.md index 69543b55..ad614acc 100644 --- a/doc/api/mobile-authorization.md +++ b/doc/api/mobile-authorization.md @@ -45,15 +45,15 @@ async createMobileAuthorizationCode( ## Example Usage ```ts -const contentType = null; -const body: CreateMobileAuthorizationCodeRequest = {}; -body.locationId = 'YOUR_LOCATION_ID'; +const body: CreateMobileAuthorizationCodeRequest = { + locationId: 'YOUR_LOCATION_ID', +}; try { const { result, ...httpResponse } = await mobileAuthorizationApi.createMobileAuthorizationCode(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/o-auth.md b/doc/api/o-auth.md index 4fff0396..8aba4f0d 100644 --- a/doc/api/o-auth.md +++ b/doc/api/o-auth.md @@ -37,7 +37,7 @@ following format: Authorization: Client APPLICATION_SECRET ``` -Replace `APPLICATION_SECRET` with the application secret on the Credentials +Replace `APPLICATION_SECRET` with the application secret on the **Credentials** page in the [Developer Dashboard](https://developer.squareup.com/apps). :information_source: **Note** This endpoint does not require authentication. @@ -55,7 +55,7 @@ async renewToken( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `clientId` | `string` | Template, Required | Your application ID, which is available in the OAuth page in the [Developer Dashboard](https://developer.squareup.com/apps). | +| `clientId` | `string` | Template, Required | Your application ID, which is available on the **OAuth** page in the [Developer Dashboard](https://developer.squareup.com/apps). | | `body` | [`RenewTokenRequest`](../../doc/models/renew-token-request.md) | Body, Required | An object containing the fields to POST for the request.

See the corresponding object definition for field details. | | `authorization` | `string` | Header, Required | Client APPLICATION_SECRET | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -68,16 +68,22 @@ async renewToken( ```ts const clientId = 'client_id8'; -const contentType = null; -const body: RenewTokenRequest = {}; -body.accessToken = 'ACCESS_TOKEN'; + +const body: RenewTokenRequest = { + accessToken: 'ACCESS_TOKEN', +}; const authorization = 'Client CLIENT_SECRET'; + try { - const { result, ...httpResponse } = await oAuthApi.renewToken(clientId, body, authorization); + const { result, ...httpResponse } = await oAuthApi.renewToken( + clientId, + body, + authorization + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -102,8 +108,8 @@ following format: Authorization: Client APPLICATION_SECRET ``` -Replace `APPLICATION_SECRET` with the application secret on the OAuth -page for your application on the Developer Dashboard. +Replace `APPLICATION_SECRET` with the application secret on the **OAuth** +page for your application in the Developer Dashboard. :information_source: **Note** This endpoint does not require authentication. @@ -130,17 +136,21 @@ async revokeToken( ## Example Usage ```ts -const contentType = null; -const body: RevokeTokenRequest = {}; -body.clientId = 'CLIENT_ID'; -body.accessToken = 'ACCESS_TOKEN'; +const body: RevokeTokenRequest = { + clientId: 'CLIENT_ID', + accessToken: 'ACCESS_TOKEN', +}; const authorization = 'Client CLIENT_SECRET'; + try { - const { result, ...httpResponse } = await oAuthApi.revokeToken(body, authorization); + const { result, ...httpResponse } = await oAuthApi.revokeToken( + body, + authorization + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -158,7 +168,7 @@ returns only an access token. The `grant_type` parameter specifies the type of OAuth request. If `grant_type` is `authorization_code`, you must include the authorization code you received when a seller granted you authorization. If `grant_type` -is `refresh_token`, you must provide a valid refresh token. If you are using +is `refresh_token`, you must provide a valid refresh token. If you're using an old version of the Square APIs (prior to March 13, 2019), `grant_type` can be `migration_token` and you must provide a valid migration token. @@ -192,19 +202,18 @@ async obtainToken( ## Example Usage ```ts -const contentType = null; const body: ObtainTokenRequest = { clientId: 'APPLICATION_ID', grantType: 'authorization_code', + clientSecret: 'APPLICATION_SECRET', + code: 'CODE_FROM_AUTHORIZE', }; -body.clientSecret = 'APPLICATION_SECRET'; -body.code = 'CODE_FROM_AUTHORIZE'; try { const { result, ...httpResponse } = await oAuthApi.obtainToken(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -254,11 +263,12 @@ async retrieveTokenStatus( ```ts const authorization = 'Client CLIENT_SECRET'; + try { const { result, ...httpResponse } = await oAuthApi.retrieveTokenStatus(authorization); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/order-custom-attributes.md b/doc/api/order-custom-attributes.md index c5ebd8ad..4252f49e 100644 --- a/doc/api/order-custom-attributes.md +++ b/doc/api/order-custom-attributes.md @@ -61,7 +61,7 @@ try { const { result, ...httpResponse } = await orderCustomAttributesApi.listOrderCustomAttributeDefinitions(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -99,23 +99,21 @@ async createOrderCustomAttributeDefinition( ## Example Usage ```ts -const contentType = null; -const bodyCustomAttributeDefinition: CustomAttributeDefinition = {}; -bodyCustomAttributeDefinition.key = 'cover-count'; -bodyCustomAttributeDefinition.name = 'Cover count'; -bodyCustomAttributeDefinition.description = 'The number of people seated at a table'; -bodyCustomAttributeDefinition.visibility = 'VISIBILITY_READ_WRITE_VALUES'; - const body: CreateOrderCustomAttributeDefinitionRequest = { - customAttributeDefinition: bodyCustomAttributeDefinition, + customAttributeDefinition: { + key: 'cover-count', + name: 'Cover count', + description: 'The number of people seated at a table', + visibility: 'VISIBILITY_READ_WRITE_VALUES', + }, + idempotencyKey: 'IDEMPOTENCY_KEY', }; -body.idempotencyKey = 'IDEMPOTENCY_KEY'; try { const { result, ...httpResponse } = await orderCustomAttributesApi.createOrderCustomAttributeDefinition(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -152,11 +150,12 @@ async deleteOrderCustomAttributeDefinition( ```ts const key = 'key0'; + try { const { result, ...httpResponse } = await orderCustomAttributesApi.deleteOrderCustomAttributeDefinition(key); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -197,11 +196,12 @@ async retrieveOrderCustomAttributeDefinition( ```ts const key = 'key0'; + try { const { result, ...httpResponse } = await orderCustomAttributesApi.retrieveOrderCustomAttributeDefinition(key); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -240,22 +240,24 @@ async updateOrderCustomAttributeDefinition( ```ts const key = 'key0'; -const contentType = null; -const bodyCustomAttributeDefinition: CustomAttributeDefinition = {}; -bodyCustomAttributeDefinition.key = 'cover-count'; -bodyCustomAttributeDefinition.visibility = 'VISIBILITY_READ_ONLY'; -bodyCustomAttributeDefinition.version = 1; const body: UpdateOrderCustomAttributeDefinitionRequest = { - customAttributeDefinition: bodyCustomAttributeDefinition, + customAttributeDefinition: { + key: 'cover-count', + visibility: 'VISIBILITY_READ_ONLY', + version: 1, + }, + idempotencyKey: 'IDEMPOTENCY_KEY', }; -body.idempotencyKey = 'IDEMPOTENCY_KEY'; try { - const { result, ...httpResponse } = await orderCustomAttributesApi.updateOrderCustomAttributeDefinition(key, body); + const { result, ...httpResponse } = await orderCustomAttributesApi.updateOrderCustomAttributeDefinition( + key, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -302,17 +304,24 @@ async bulkDeleteOrderCustomAttributes( ## Example Usage ```ts -const contentType = null; -const bodyValues: Record = {}; const body: BulkDeleteOrderCustomAttributesRequest = { - values: bodyValues, + values: { + 'cover-count': { + orderId: '7BbXGEIWNldxAzrtGf9GPVZTwZ4F', + key: 'cover-count', + }, + 'table-number': { + orderId: '7BbXGEIWNldxAzrtGf9GPVZTwZ4F', + key: 'table-number', + } + }, }; try { const { result, ...httpResponse } = await orderCustomAttributesApi.bulkDeleteOrderCustomAttributes(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -359,17 +368,24 @@ async bulkUpsertOrderCustomAttributes( ## Example Usage ```ts -const contentType = null; -const bodyValues: Record = {}; const body: BulkUpsertOrderCustomAttributesRequest = { - values: bodyValues, + values: { + 'key0': { + customAttribute: {}, + orderId: 'order_id2', + }, + 'key1': { + customAttribute: {}, + orderId: 'order_id1', + } + }, }; try { const { result, ...httpResponse } = await orderCustomAttributesApi.bulkUpsertOrderCustomAttributes(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -419,12 +435,17 @@ async listOrderCustomAttributes( ```ts const orderId = 'order_id6'; + const withDefinitions = false; + try { - const { result, ...httpResponse } = await orderCustomAttributesApi.listOrderCustomAttributes(orderId, None, None, None, withDefinitions); + const { result, ...httpResponse } = await orderCustomAttributesApi.listOrderCustomAttributes( + orderId, + withDefinitions + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -465,12 +486,17 @@ async deleteOrderCustomAttribute( ```ts const orderId = 'order_id6'; + const customAttributeKey = 'custom_attribute_key2'; + try { - const { result, ...httpResponse } = await orderCustomAttributesApi.deleteOrderCustomAttribute(orderId, customAttributeKey); + const { result, ...httpResponse } = await orderCustomAttributesApi.deleteOrderCustomAttribute( + orderId, + customAttributeKey + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -518,13 +544,20 @@ async retrieveOrderCustomAttribute( ```ts const orderId = 'order_id6'; + const customAttributeKey = 'custom_attribute_key2'; + const withDefinition = false; + try { - const { result, ...httpResponse } = await orderCustomAttributesApi.retrieveOrderCustomAttribute(orderId, customAttributeKey, None, withDefinition); + const { result, ...httpResponse } = await orderCustomAttributesApi.retrieveOrderCustomAttribute( + orderId, + customAttributeKey, + withDefinition + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -571,19 +604,22 @@ async upsertOrderCustomAttribute( ```ts const orderId = 'order_id6'; + const customAttributeKey = 'custom_attribute_key2'; -const contentType = null; -const bodyCustomAttribute: CustomAttribute = {}; const body: UpsertOrderCustomAttributeRequest = { - customAttribute: bodyCustomAttribute, + customAttribute: {}, }; try { - const { result, ...httpResponse } = await orderCustomAttributesApi.upsertOrderCustomAttribute(orderId, customAttributeKey, body); + const { result, ...httpResponse } = await orderCustomAttributesApi.upsertOrderCustomAttribute( + orderId, + customAttributeKey, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/orders.md b/doc/api/orders.md index 42730749..7823602e 100644 --- a/doc/api/orders.md +++ b/doc/api/orders.md @@ -51,101 +51,73 @@ async createOrder( ## Example Usage ```ts -const contentType = null; -const bodyOrderLineItems: OrderLineItem[] = []; - -const bodyOrderlineItems0BasePriceMoney: Money = {}; -bodyOrderlineItems0BasePriceMoney.amount = BigInt(1599); -bodyOrderlineItems0BasePriceMoney.currency = 'USD'; - -const bodyOrderlineItems0: OrderLineItem = { - quantity: '1', -}; -bodyOrderlineItems0.name = 'New York Strip Steak'; -bodyOrderlineItems0.basePriceMoney = bodyOrderlineItems0BasePriceMoney; - -bodyOrderLineItems[0] = bodyOrderlineItems0; - -const bodyOrderlineItems1Modifiers: OrderLineItemModifier[] = []; - -const bodyOrderlineItems1modifiers0: OrderLineItemModifier = {}; -bodyOrderlineItems1modifiers0.catalogObjectId = 'CHQX7Y4KY6N5KINJKZCFURPZ'; - -bodyOrderlineItems1Modifiers[0] = bodyOrderlineItems1modifiers0; - -const bodyOrderlineItems1AppliedDiscounts: OrderLineItemAppliedDiscount[] = []; - -const bodyOrderlineItems1appliedDiscounts0: OrderLineItemAppliedDiscount = { - discountUid: 'one-dollar-off', -}; - -bodyOrderlineItems1AppliedDiscounts[0] = bodyOrderlineItems1appliedDiscounts0; - -const bodyOrderlineItems1: OrderLineItem = { - quantity: '2', -}; -bodyOrderlineItems1.catalogObjectId = 'BEMYCSMIJL46OCDV4KYIKXIB'; -bodyOrderlineItems1.modifiers = bodyOrderlineItems1Modifiers; -bodyOrderlineItems1.appliedDiscounts = bodyOrderlineItems1AppliedDiscounts; - -bodyOrderLineItems[1] = bodyOrderlineItems1; - -const bodyOrderTaxes: OrderLineItemTax[] = []; - -const bodyOrdertaxes0: OrderLineItemTax = {}; -bodyOrdertaxes0.uid = 'state-sales-tax'; -bodyOrdertaxes0.name = 'State Sales Tax'; -bodyOrdertaxes0.percentage = '9'; -bodyOrdertaxes0.scope = 'ORDER'; - -bodyOrderTaxes[0] = bodyOrdertaxes0; - -const bodyOrderDiscounts: OrderLineItemDiscount[] = []; - -const bodyOrderdiscounts0: OrderLineItemDiscount = {}; -bodyOrderdiscounts0.uid = 'labor-day-sale'; -bodyOrderdiscounts0.name = 'Labor Day Sale'; -bodyOrderdiscounts0.percentage = '5'; -bodyOrderdiscounts0.scope = 'ORDER'; - -bodyOrderDiscounts[0] = bodyOrderdiscounts0; - -const bodyOrderdiscounts1: OrderLineItemDiscount = {}; -bodyOrderdiscounts1.uid = 'membership-discount'; -bodyOrderdiscounts1.catalogObjectId = 'DB7L55ZH2BGWI4H23ULIWOQ7'; -bodyOrderdiscounts1.scope = 'ORDER'; - -bodyOrderDiscounts[1] = bodyOrderdiscounts1; - -const bodyOrderdiscounts2AmountMoney: Money = {}; -bodyOrderdiscounts2AmountMoney.amount = BigInt(100); -bodyOrderdiscounts2AmountMoney.currency = 'USD'; - -const bodyOrderdiscounts2: OrderLineItemDiscount = {}; -bodyOrderdiscounts2.uid = 'one-dollar-off'; -bodyOrderdiscounts2.name = 'Sale - $1.00 off'; -bodyOrderdiscounts2.amountMoney = bodyOrderdiscounts2AmountMoney; -bodyOrderdiscounts2.scope = 'LINE_ITEM'; - -bodyOrderDiscounts[2] = bodyOrderdiscounts2; - -const bodyOrder: Order = { - locationId: '057P5VYJ4A5X1', +const body: CreateOrderRequest = { + order: { + locationId: '057P5VYJ4A5X1', + referenceId: 'my-order-001', + lineItems: [ + { + quantity: '1', + name: 'New York Strip Steak', + basePriceMoney: { + amount: BigInt(1599), + currency: 'USD', + }, + }, + { + quantity: '2', + catalogObjectId: 'BEMYCSMIJL46OCDV4KYIKXIB', + modifiers: [ + { + catalogObjectId: 'CHQX7Y4KY6N5KINJKZCFURPZ', + } + ], + appliedDiscounts: [ + { + discountUid: 'one-dollar-off', + } + ], + } + ], + taxes: [ + { + uid: 'state-sales-tax', + name: 'State Sales Tax', + percentage: '9', + scope: 'ORDER', + } + ], + discounts: [ + { + uid: 'labor-day-sale', + name: 'Labor Day Sale', + percentage: '5', + scope: 'ORDER', + }, + { + uid: 'membership-discount', + catalogObjectId: 'DB7L55ZH2BGWI4H23ULIWOQ7', + scope: 'ORDER', + }, + { + uid: 'one-dollar-off', + name: 'Sale - $1.00 off', + amountMoney: { + amount: BigInt(100), + currency: 'USD', + }, + scope: 'LINE_ITEM', + } + ], + }, + idempotencyKey: '8193148c-9586-11e6-99f9-28cfe92138cf', }; -bodyOrder.referenceId = 'my-order-001'; -bodyOrder.lineItems = bodyOrderLineItems; -bodyOrder.taxes = bodyOrderTaxes; -bodyOrder.discounts = bodyOrderDiscounts; - -const body: CreateOrderRequest = {}; -body.order = bodyOrder; -body.idempotencyKey = '8193148c-9586-11e6-99f9-28cfe92138cf'; try { const { result, ...httpResponse } = await ordersApi.createOrder(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -181,18 +153,19 @@ async batchRetrieveOrders( ## Example Usage ```ts -const contentType = null; -const bodyOrderIds: string[] = ['CAISEM82RcpmcFBM0TfOyiHV3es', 'CAISENgvlJ6jLWAzERDzjyHVybY']; const body: BatchRetrieveOrdersRequest = { - orderIds: bodyOrderIds, + orderIds: [ + 'CAISEM82RcpmcFBM0TfOyiHV3es', + 'CAISENgvlJ6jLWAzERDzjyHVybY' + ], + locationId: '057P5VYJ4A5X1', }; -body.locationId = '057P5VYJ4A5X1'; try { const { result, ...httpResponse } = await ordersApi.batchRetrieveOrders(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -226,57 +199,42 @@ async calculateOrder( ## Example Usage ```ts -const contentType = null; -const bodyOrderLineItems: OrderLineItem[] = []; - -const bodyOrderlineItems0BasePriceMoney: Money = {}; -bodyOrderlineItems0BasePriceMoney.amount = BigInt(500); -bodyOrderlineItems0BasePriceMoney.currency = 'USD'; - -const bodyOrderlineItems0: OrderLineItem = { - quantity: '1', -}; -bodyOrderlineItems0.name = 'Item 1'; -bodyOrderlineItems0.basePriceMoney = bodyOrderlineItems0BasePriceMoney; - -bodyOrderLineItems[0] = bodyOrderlineItems0; - -const bodyOrderlineItems1BasePriceMoney: Money = {}; -bodyOrderlineItems1BasePriceMoney.amount = BigInt(300); -bodyOrderlineItems1BasePriceMoney.currency = 'USD'; - -const bodyOrderlineItems1: OrderLineItem = { - quantity: '2', -}; -bodyOrderlineItems1.name = 'Item 2'; -bodyOrderlineItems1.basePriceMoney = bodyOrderlineItems1BasePriceMoney; - -bodyOrderLineItems[1] = bodyOrderlineItems1; - -const bodyOrderDiscounts: OrderLineItemDiscount[] = []; - -const bodyOrderdiscounts0: OrderLineItemDiscount = {}; -bodyOrderdiscounts0.name = '50% Off'; -bodyOrderdiscounts0.percentage = '50'; -bodyOrderdiscounts0.scope = 'ORDER'; - -bodyOrderDiscounts[0] = bodyOrderdiscounts0; - -const bodyOrder: Order = { - locationId: 'D7AVYMEAPJ3A3', -}; -bodyOrder.lineItems = bodyOrderLineItems; -bodyOrder.discounts = bodyOrderDiscounts; - const body: CalculateOrderRequest = { - order: bodyOrder, + order: { + locationId: 'D7AVYMEAPJ3A3', + lineItems: [ + { + quantity: '1', + name: 'Item 1', + basePriceMoney: { + amount: BigInt(500), + currency: 'USD', + }, + }, + { + quantity: '2', + name: 'Item 2', + basePriceMoney: { + amount: BigInt(300), + currency: 'USD', + }, + } + ], + discounts: [ + { + name: '50% Off', + percentage: '50', + scope: 'ORDER', + } + ], + }, }; try { const { result, ...httpResponse } = await ordersApi.calculateOrder(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -311,18 +269,17 @@ async cloneOrder( ## Example Usage ```ts -const contentType = null; const body: CloneOrderRequest = { orderId: 'ZAISEM52YcpmcWAzERDOyiWS123', + version: 3, + idempotencyKey: 'UNIQUE_STRING', }; -body.version = 3; -body.idempotencyKey = 'UNIQUE_STRING'; try { const { result, ...httpResponse } = await ordersApi.cloneOrder(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -372,44 +329,39 @@ async searchOrders( ## Example Usage ```ts -const contentType = null; -const bodyLocationIds: string[] = ['057P5VYJ4A5X1', '18YC4JDH91E1H']; -const bodyQueryFilterStateFilterStates: string[] = ['COMPLETED']; -const bodyQueryFilterStateFilter: SearchOrdersStateFilter = { - states: bodyQueryFilterStateFilterStates, +const body: SearchOrdersRequest = { + locationIds: [ + '057P5VYJ4A5X1', + '18YC4JDH91E1H' + ], + query: { + filter: { + stateFilter: { + states: [ + 'COMPLETED' + ], + }, + dateTimeFilter: { + closedAt: { + startAt: '2018-03-03T20:00:00+00:00', + endAt: '2019-03-04T21:54:45+00:00', + }, + }, + }, + sort: { + sortField: 'CLOSED_AT', + sortOrder: 'DESC', + }, + }, + limit: 3, + returnEntries: true, }; -const bodyQueryFilterDateTimeFilterClosedAt: TimeRange = {}; -bodyQueryFilterDateTimeFilterClosedAt.startAt = '2018-03-03T20:00:00+00:00'; -bodyQueryFilterDateTimeFilterClosedAt.endAt = '2019-03-04T21:54:45+00:00'; - -const bodyQueryFilterDateTimeFilter: SearchOrdersDateTimeFilter = {}; -bodyQueryFilterDateTimeFilter.closedAt = bodyQueryFilterDateTimeFilterClosedAt; - -const bodyQueryFilter: SearchOrdersFilter = {}; -bodyQueryFilter.stateFilter = bodyQueryFilterStateFilter; -bodyQueryFilter.dateTimeFilter = bodyQueryFilterDateTimeFilter; - -const bodyQuerySort: SearchOrdersSort = { - sortField: 'CLOSED_AT', -}; -bodyQuerySort.sortOrder = 'DESC'; - -const bodyQuery: SearchOrdersQuery = {}; -bodyQuery.filter = bodyQueryFilter; -bodyQuery.sort = bodyQuerySort; - -const body: SearchOrdersRequest = {}; -body.locationIds = bodyLocationIds; -body.query = bodyQuery; -body.limit = 3; -body.returnEntries = true; - try { const { result, ...httpResponse } = await ordersApi.searchOrders(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -444,11 +396,12 @@ async retrieveOrder( ```ts const orderId = 'order_id6'; + try { const { result, ...httpResponse } = await ordersApi.retrieveOrder(orderId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -499,14 +452,17 @@ async updateOrder( ```ts const orderId = 'order_id6'; -const contentType = null; + const body: UpdateOrderRequest = {}; try { - const { result, ...httpResponse } = await ordersApi.updateOrder(orderId, body); + const { result, ...httpResponse } = await ordersApi.updateOrder( + orderId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -556,18 +512,23 @@ async payOrder( ```ts const orderId = 'order_id6'; -const contentType = null; -const bodyPaymentIds: string[] = ['EnZdNAlWCmfh6Mt5FMNST1o7taB', '0LRiVlbXVwe8ozu4KbZxd12mvaB']; + const body: PayOrderRequest = { idempotencyKey: 'c043a359-7ad9-4136-82a9-c3f1d66dcbff', + paymentIds: [ + 'EnZdNAlWCmfh6Mt5FMNST1o7taB', + '0LRiVlbXVwe8ozu4KbZxd12mvaB' + ], }; -body.paymentIds = bodyPaymentIds; try { - const { result, ...httpResponse } = await ordersApi.payOrder(orderId, body); + const { result, ...httpResponse } = await ordersApi.payOrder( + orderId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/payments.md b/doc/api/payments.md index 88596a03..d930b1cd 100644 --- a/doc/api/payments.md +++ b/doc/api/payments.md @@ -69,7 +69,7 @@ try { const { result, ...httpResponse } = await paymentsApi.listPayments(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -110,32 +110,29 @@ async createPayment( ## Example Usage ```ts -const contentType = null; -const bodyAmountMoney: Money = {}; -bodyAmountMoney.amount = BigInt(1000); -bodyAmountMoney.currency = 'USD'; - -const bodyAppFeeMoney: Money = {}; -bodyAppFeeMoney.amount = BigInt(10); -bodyAppFeeMoney.currency = 'USD'; - const body: CreatePaymentRequest = { sourceId: 'ccof:GaJGNaZa8x4OgDJn4GB', idempotencyKey: '7b0f3ec5-086a-4871-8f13-3c81b3875218', + amountMoney: { + amount: BigInt(1000), + currency: 'USD', + }, + appFeeMoney: { + amount: BigInt(10), + currency: 'USD', + }, + autocomplete: true, + customerId: 'W92WH6P11H4Z77CTET0RNTGFW8', + locationId: 'L88917AVBK2S5', + referenceId: '123456', + note: 'Brief description', }; -body.amountMoney = bodyAmountMoney; -body.appFeeMoney = bodyAppFeeMoney; -body.autocomplete = true; -body.customerId = 'W92WH6P11H4Z77CTET0RNTGFW8'; -body.locationId = 'L88917AVBK2S5'; -body.referenceId = '123456'; -body.note = 'Brief description'; try { const { result, ...httpResponse } = await paymentsApi.createPayment(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -179,7 +176,6 @@ async cancelPaymentByIdempotencyKey( ## Example Usage ```ts -const contentType = null; const body: CancelPaymentByIdempotencyKeyRequest = { idempotencyKey: 'a7e36d40-d24b-11e8-b568-0800200c9a66', }; @@ -188,7 +184,7 @@ try { const { result, ...httpResponse } = await paymentsApi.cancelPaymentByIdempotencyKey(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -223,11 +219,12 @@ async getPayment( ```ts const paymentId = 'payment_id0'; + try { const { result, ...httpResponse } = await paymentsApi.getPayment(paymentId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -265,30 +262,30 @@ async updatePayment( ```ts const paymentId = 'payment_id0'; -const contentType = null; -const bodyPaymentAmountMoney: Money = {}; -bodyPaymentAmountMoney.amount = BigInt(1000); -bodyPaymentAmountMoney.currency = 'USD'; - -const bodyPaymentTipMoney: Money = {}; -bodyPaymentTipMoney.amount = BigInt(100); -bodyPaymentTipMoney.currency = 'USD'; - -const bodyPayment: Payment = {}; -bodyPayment.amountMoney = bodyPaymentAmountMoney; -bodyPayment.tipMoney = bodyPaymentTipMoney; -bodyPayment.versionToken = 'ODhwVQ35xwlzRuoZEwKXucfu7583sPTzK48c5zoGd0g6o'; const body: UpdatePaymentRequest = { idempotencyKey: '956f8b13-e4ec-45d6-85e8-d1d95ef0c5de', + payment: { + amountMoney: { + amount: BigInt(1000), + currency: 'USD', + }, + tipMoney: { + amount: BigInt(100), + currency: 'USD', + }, + versionToken: 'ODhwVQ35xwlzRuoZEwKXucfu7583sPTzK48c5zoGd0g6o', + }, }; -body.payment = bodyPayment; try { - const { result, ...httpResponse } = await paymentsApi.updatePayment(paymentId, body); + const { result, ...httpResponse } = await paymentsApi.updatePayment( + paymentId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -324,11 +321,12 @@ async cancelPayment( ```ts const paymentId = 'payment_id0'; + try { const { result, ...httpResponse } = await paymentsApi.cancelPayment(paymentId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -368,14 +366,17 @@ async completePayment( ```ts const paymentId = 'payment_id0'; -const contentType = null; + const body: CompletePaymentRequest = {}; try { - const { result, ...httpResponse } = await paymentsApi.completePayment(paymentId, body); + const { result, ...httpResponse } = await paymentsApi.completePayment( + paymentId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/payouts.md b/doc/api/payouts.md index a2f8a32b..dc33df5d 100644 --- a/doc/api/payouts.md +++ b/doc/api/payouts.md @@ -58,7 +58,7 @@ try { const { result, ...httpResponse } = await payoutsApi.listPayouts(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -94,11 +94,12 @@ async getPayout( ```ts const payoutId = 'payout_id6'; + try { const { result, ...httpResponse } = await payoutsApi.getPayout(payoutId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -140,11 +141,12 @@ async listPayoutEntries( ```ts const payoutId = 'payout_id6'; + try { const { result, ...httpResponse } = await payoutsApi.listPayoutEntries(payoutId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/refunds.md b/doc/api/refunds.md index f1ace2a5..840f5851 100644 --- a/doc/api/refunds.md +++ b/doc/api/refunds.md @@ -63,7 +63,7 @@ try { const { result, ...httpResponse } = await refundsApi.listPaymentRefunds(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -100,28 +100,25 @@ async refundPayment( ## Example Usage ```ts -const contentType = null; -const bodyAmountMoney: Money = {}; -bodyAmountMoney.amount = BigInt(1000); -bodyAmountMoney.currency = 'USD'; - -const bodyAppFeeMoney: Money = {}; -bodyAppFeeMoney.amount = BigInt(10); -bodyAppFeeMoney.currency = 'USD'; - const body: RefundPaymentRequest = { idempotencyKey: '9b7f2dcf-49da-4411-b23e-a2d6af21333a', - amountMoney: bodyAmountMoney, + amountMoney: { + amount: BigInt(1000), + currency: 'USD', + }, + appFeeMoney: { + amount: BigInt(10), + currency: 'USD', + }, + paymentId: 'R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY', + reason: 'Example', }; -body.appFeeMoney = bodyAppFeeMoney; -body.paymentId = 'R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY'; -body.reason = 'Example'; try { const { result, ...httpResponse } = await refundsApi.refundPayment(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -156,11 +153,12 @@ async getPaymentRefund( ```ts const refundId = 'refund_id4'; + try { const { result, ...httpResponse } = await refundsApi.getPaymentRefund(refundId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/sites.md b/doc/api/sites.md index d11b70e9..f72f3234 100644 --- a/doc/api/sites.md +++ b/doc/api/sites.md @@ -38,7 +38,7 @@ try { const { result, ...httpResponse } = await sitesApi.listSites(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/snippets.md b/doc/api/snippets.md index de07447a..cf100019 100644 --- a/doc/api/snippets.md +++ b/doc/api/snippets.md @@ -45,11 +45,12 @@ async deleteSnippet( ```ts const siteId = 'site_id6'; + try { const { result, ...httpResponse } = await snippetsApi.deleteSnippet(siteId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -88,11 +89,12 @@ async retrieveSnippet( ```ts const siteId = 'site_id6'; + try { const { result, ...httpResponse } = await snippetsApi.retrieveSnippet(siteId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -134,20 +136,21 @@ async upsertSnippet( ```ts const siteId = 'site_id6'; -const contentType = null; -const bodySnippet: Snippet = { - content: '', -}; const body: UpsertSnippetRequest = { - snippet: bodySnippet, + snippet: { + content: '', + }, }; try { - const { result, ...httpResponse } = await snippetsApi.upsertSnippet(siteId, body); + const { result, ...httpResponse } = await snippetsApi.upsertSnippet( + siteId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/subscriptions.md b/doc/api/subscriptions.md index 112c20cd..9168e3e3 100644 --- a/doc/api/subscriptions.md +++ b/doc/api/subscriptions.md @@ -24,13 +24,15 @@ const subscriptionsApi = client.subscriptionsApi; # Create Subscription -Creates a subscription to a subscription plan by a customer. +Enrolls a customer in a subscription. If you provide a card on file in the request, Square charges the card for -the subscription. Otherwise, Square bills an invoice to the customer's email +the subscription. Otherwise, Square sends an invoice to the customer's email address. The subscription starts immediately, unless the request includes the optional `start_date`. Each individual subscription is associated with a particular location. +For more information, see [Create a subscription](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions#create-a-subscription). + ```ts async createSubscription( body: CreateSubscriptionRequest, @@ -52,32 +54,29 @@ async createSubscription( ## Example Usage ```ts -const contentType = null; -const bodyPriceOverrideMoney: Money = {}; -bodyPriceOverrideMoney.amount = BigInt(100); -bodyPriceOverrideMoney.currency = 'USD'; - -const bodySource: SubscriptionSource = {}; -bodySource.name = 'My App'; - const body: CreateSubscriptionRequest = { locationId: 'S8GWD5R9QB376', - planId: '6JHXF3B2CW3YKHDV4XEM674H', customerId: 'CHFGVKYY8RSV93M5KCYTG4PN0G', + idempotencyKey: '8193148c-9586-11e6-99f9-28cfe92138cf', + planId: '6JHXF3B2CW3YKHDV4XEM674H', + startDate: '2021-10-20', + taxPercentage: '5', + priceOverrideMoney: { + amount: BigInt(100), + currency: 'USD', + }, + cardId: 'ccof:qy5x8hHGYsgLrp4Q4GB', + timezone: 'America/Los_Angeles', + source: { + name: 'My App', + }, }; -body.idempotencyKey = '8193148c-9586-11e6-99f9-28cfe92138cf'; -body.startDate = '2021-10-20'; -body.taxPercentage = '5'; -body.priceOverrideMoney = bodyPriceOverrideMoney; -body.cardId = 'ccof:qy5x8hHGYsgLrp4Q4GB'; -body.timezone = 'America/Los_Angeles'; -body.source = bodySource; try { const { result, ...httpResponse } = await subscriptionsApi.createSubscription(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -103,9 +102,6 @@ If the request specifies customer IDs, the endpoint orders results first by location, within location by customer ID, and within customer by subscription creation date. -For more information, see -[Retrieve subscriptions](https://developer.squareup.com/docs/subscriptions-api/overview#retrieve-subscriptions). - ```ts async searchSubscriptions( body: SearchSubscriptionsRequest, @@ -127,26 +123,27 @@ async searchSubscriptions( ## Example Usage ```ts -const contentType = null; -const bodyQueryFilterCustomerIds: string[] = ['CHFGVKYY8RSV93M5KCYTG4PN0G']; -const bodyQueryFilterLocationIds: string[] = ['S8GWD5R9QB376']; -const bodyQueryFilterSourceNames: string[] = ['My App']; -const bodyQueryFilter: SearchSubscriptionsFilter = {}; -bodyQueryFilter.customerIds = bodyQueryFilterCustomerIds; -bodyQueryFilter.locationIds = bodyQueryFilterLocationIds; -bodyQueryFilter.sourceNames = bodyQueryFilterSourceNames; - -const bodyQuery: SearchSubscriptionsQuery = {}; -bodyQuery.filter = bodyQueryFilter; - -const body: SearchSubscriptionsRequest = {}; -body.query = bodyQuery; +const body: SearchSubscriptionsRequest = { + query: { + filter: { + customerIds: [ + 'CHFGVKYY8RSV93M5KCYTG4PN0G' + ], + locationIds: [ + 'S8GWD5R9QB376' + ], + sourceNames: [ + 'My App' + ], + }, + }, +}; try { const { result, ...httpResponse } = await subscriptionsApi.searchSubscriptions(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -157,7 +154,7 @@ try { # Retrieve Subscription -Retrieves a subscription. +Retrieves a specific subscription. ```ts async retrieveSubscription( @@ -183,11 +180,12 @@ async retrieveSubscription( ```ts const subscriptionId = 'subscription_id0'; + try { const { result, ...httpResponse } = await subscriptionsApi.retrieveSubscription(subscriptionId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -198,8 +196,8 @@ try { # Update Subscription -Updates a subscription. You can set, modify, and clear the -`subscription` field values. +Updates a subscription by modifying or clearing `subscription` field values. +To clear a field, set its value to `null`. ```ts async updateSubscription( @@ -225,17 +223,19 @@ async updateSubscription( ```ts const subscriptionId = 'subscription_id0'; -const contentType = null; -const bodySubscription: Subscription = {}; -const body: UpdateSubscriptionRequest = {}; -body.subscription = bodySubscription; +const body: UpdateSubscriptionRequest = { + subscription: {}, +}; try { - const { result, ...httpResponse } = await subscriptionsApi.updateSubscription(subscriptionId, body); + const { result, ...httpResponse } = await subscriptionsApi.updateSubscription( + subscriptionId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -272,12 +272,17 @@ async deleteSubscriptionAction( ```ts const subscriptionId = 'subscription_id0'; + const actionId = 'action_id6'; + try { - const { result, ...httpResponse } = await subscriptionsApi.deleteSubscriptionAction(subscriptionId, actionId); + const { result, ...httpResponse } = await subscriptionsApi.deleteSubscriptionAction( + subscriptionId, + actionId + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -288,9 +293,9 @@ try { # Cancel Subscription -Schedules a `CANCEL` action to cancel an active subscription -by setting the `canceled_date` field to the end of the active billing period -and changing the subscription status from ACTIVE to CANCELED after this date. +Schedules a `CANCEL` action to cancel an active subscription. This +sets the `canceled_date` field to the end of the active billing period. After this date, +the subscription status changes from ACTIVE to CANCELED. ```ts async cancelSubscription( @@ -314,11 +319,12 @@ async cancelSubscription( ```ts const subscriptionId = 'subscription_id0'; + try { const { result, ...httpResponse } = await subscriptionsApi.cancelSubscription(subscriptionId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -329,7 +335,7 @@ try { # List Subscription Events -Lists all events for a specific subscription. +Lists all [events](https://developer.squareup.com/docs/subscriptions-api/actions-events) for a specific subscription. ```ts async listSubscriptionEvents( @@ -345,7 +351,7 @@ async listSubscriptionEvents( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `subscriptionId` | `string` | Template, Required | The ID of the subscription to retrieve the events for. | -| `cursor` | `string \| undefined` | Query, Optional | When the total number of resulting subscription events exceeds the limit of a paged response,
specify the cursor returned from a preceding response here to fetch the next set of results.
If the cursor is unset, the response contains the last page of the results.

For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). | +| `cursor` | `string \| undefined` | Query, Optional | When the total number of resulting subscription events exceeds the limit of a paged response,
specify the cursor returned from a preceding response here to fetch the next set of results.
If the cursor is unset, the response contains the last page of the results.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | | `limit` | `number \| undefined` | Query, Optional | The upper limit on the number of subscription events to return
in a paged response. | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | @@ -357,11 +363,12 @@ async listSubscriptionEvents( ```ts const subscriptionId = 'subscription_id0'; + try { const { result, ...httpResponse } = await subscriptionsApi.listSubscriptionEvents(subscriptionId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -398,14 +405,17 @@ async pauseSubscription( ```ts const subscriptionId = 'subscription_id0'; -const contentType = null; + const body: PauseSubscriptionRequest = {}; try { - const { result, ...httpResponse } = await subscriptionsApi.pauseSubscription(subscriptionId, body); + const { result, ...httpResponse } = await subscriptionsApi.pauseSubscription( + subscriptionId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -442,14 +452,17 @@ async resumeSubscription( ```ts const subscriptionId = 'subscription_id0'; -const contentType = null; + const body: ResumeSubscriptionRequest = {}; try { - const { result, ...httpResponse } = await subscriptionsApi.resumeSubscription(subscriptionId, body); + const { result, ...httpResponse } = await subscriptionsApi.resumeSubscription( + subscriptionId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -460,7 +473,8 @@ try { # Swap Plan -Schedules a `SWAP_PLAN` action to swap a subscription plan in an existing subscription. +Schedules a `SWAP_PLAN` action to swap a subscription plan variation in an existing subscription. +For more information, see [Swap Subscription Plan Variations](https://developer.squareup.com/docs/subscriptions-api/swap-plan-variations). ```ts async swapPlan( @@ -486,16 +500,17 @@ async swapPlan( ```ts const subscriptionId = 'subscription_id0'; -const contentType = null; -const body: SwapPlanRequest = { - newPlanId: null, -}; + +const body: SwapPlanRequest = {}; try { - const { result, ...httpResponse } = await subscriptionsApi.swapPlan(subscriptionId, body); + const { result, ...httpResponse } = await subscriptionsApi.swapPlan( + subscriptionId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/team.md b/doc/api/team.md index 8ee8836c..3c4c6258 100644 --- a/doc/api/team.md +++ b/doc/api/team.md @@ -51,30 +51,30 @@ async createTeamMember( ## Example Usage ```ts -const contentType = null; -const bodyTeamMemberAssignedLocationsLocationIds: string[] = ['YSGH2WBKG94QZ', 'GA2Y9HSJ8KRYT']; -const bodyTeamMemberAssignedLocations: TeamMemberAssignedLocations = {}; -bodyTeamMemberAssignedLocations.assignmentType = 'EXPLICIT_LOCATIONS'; -bodyTeamMemberAssignedLocations.locationIds = bodyTeamMemberAssignedLocationsLocationIds; - -const bodyTeamMember: TeamMember = {}; -bodyTeamMember.referenceId = 'reference_id_1'; -bodyTeamMember.status = 'ACTIVE'; -bodyTeamMember.givenName = 'Joe'; -bodyTeamMember.familyName = 'Doe'; -bodyTeamMember.emailAddress = 'joe_doe@gmail.com'; -bodyTeamMember.phoneNumber = '+14159283333'; -bodyTeamMember.assignedLocations = bodyTeamMemberAssignedLocations; - -const body: CreateTeamMemberRequest = {}; -body.idempotencyKey = 'idempotency-key-0'; -body.teamMember = bodyTeamMember; +const body: CreateTeamMemberRequest = { + idempotencyKey: 'idempotency-key-0', + teamMember: { + referenceId: 'reference_id_1', + status: 'ACTIVE', + givenName: 'Joe', + familyName: 'Doe', + emailAddress: 'joe_doe@gmail.com', + phoneNumber: '+14159283333', + assignedLocations: { + assignmentType: 'EXPLICIT_LOCATIONS', + locationIds: [ + 'YSGH2WBKG94QZ', + 'GA2Y9HSJ8KRYT' + ], + }, + }, +}; try { const { result, ...httpResponse } = await teamApi.createTeamMember(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -113,17 +113,44 @@ async bulkCreateTeamMembers( ## Example Usage ```ts -const contentType = null; -const bodyTeamMembers: Record = {}; const body: BulkCreateTeamMembersRequest = { - teamMembers: bodyTeamMembers, + teamMembers: { + 'idempotency-key-1': { + teamMember: { + referenceId: 'reference_id_1', + givenName: 'Joe', + familyName: 'Doe', + emailAddress: 'joe_doe@gmail.com', + phoneNumber: '+14159283333', + assignedLocations: { + assignmentType: 'EXPLICIT_LOCATIONS', + locationIds: [ + 'YSGH2WBKG94QZ', + 'GA2Y9HSJ8KRYT' + ], + }, + }, + }, + 'idempotency-key-2': { + teamMember: { + referenceId: 'reference_id_2', + givenName: 'Jane', + familyName: 'Smith', + emailAddress: 'jane_smith@gmail.com', + phoneNumber: '+14159223334', + assignedLocations: { + assignmentType: 'ALL_CURRENT_AND_FUTURE_LOCATIONS', + }, + }, + } + }, }; try { const { result, ...httpResponse } = await teamApi.bulkCreateTeamMembers(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -161,17 +188,48 @@ async bulkUpdateTeamMembers( ## Example Usage ```ts -const contentType = null; -const bodyTeamMembers: Record = {}; const body: BulkUpdateTeamMembersRequest = { - teamMembers: bodyTeamMembers, + teamMembers: { + 'AFMwA08kR-MIF-3Vs0OE': { + teamMember: { + referenceId: 'reference_id_2', + isOwner: false, + status: 'ACTIVE', + givenName: 'Jane', + familyName: 'Smith', + emailAddress: 'jane_smith@gmail.com', + phoneNumber: '+14159223334', + assignedLocations: { + assignmentType: 'ALL_CURRENT_AND_FUTURE_LOCATIONS', + }, + }, + }, + 'fpgteZNMaf0qOK-a4t6P': { + teamMember: { + referenceId: 'reference_id_1', + isOwner: false, + status: 'ACTIVE', + givenName: 'Joe', + familyName: 'Doe', + emailAddress: 'joe_doe@gmail.com', + phoneNumber: '+14159283333', + assignedLocations: { + assignmentType: 'EXPLICIT_LOCATIONS', + locationIds: [ + 'YSGH2WBKG94QZ', + 'GA2Y9HSJ8KRYT' + ], + }, + }, + } + }, }; try { const { result, ...httpResponse } = await teamApi.bulkUpdateTeamMembers(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -209,24 +267,23 @@ async searchTeamMembers( ## Example Usage ```ts -const contentType = null; -const bodyQueryFilterLocationIds: string[] = ['0G5P3VGACMMQZ']; -const bodyQueryFilter: SearchTeamMembersFilter = {}; -bodyQueryFilter.locationIds = bodyQueryFilterLocationIds; -bodyQueryFilter.status = 'ACTIVE'; - -const bodyQuery: SearchTeamMembersQuery = {}; -bodyQuery.filter = bodyQueryFilter; - -const body: SearchTeamMembersRequest = {}; -body.query = bodyQuery; -body.limit = 10; +const body: SearchTeamMembersRequest = { + query: { + filter: { + locationIds: [ + '0G5P3VGACMMQZ' + ], + status: 'ACTIVE', + }, + }, + limit: 10, +}; try { const { result, ...httpResponse } = await teamApi.searchTeamMembers(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -262,11 +319,12 @@ async retrieveTeamMember( ```ts const teamMemberId = 'team_member_id0'; + try { const { result, ...httpResponse } = await teamApi.retrieveTeamMember(teamMemberId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -304,29 +362,33 @@ async updateTeamMember( ```ts const teamMemberId = 'team_member_id0'; -const contentType = null; -const bodyTeamMemberAssignedLocationsLocationIds: string[] = ['YSGH2WBKG94QZ', 'GA2Y9HSJ8KRYT']; -const bodyTeamMemberAssignedLocations: TeamMemberAssignedLocations = {}; -bodyTeamMemberAssignedLocations.assignmentType = 'EXPLICIT_LOCATIONS'; -bodyTeamMemberAssignedLocations.locationIds = bodyTeamMemberAssignedLocationsLocationIds; - -const bodyTeamMember: TeamMember = {}; -bodyTeamMember.referenceId = 'reference_id_1'; -bodyTeamMember.status = 'ACTIVE'; -bodyTeamMember.givenName = 'Joe'; -bodyTeamMember.familyName = 'Doe'; -bodyTeamMember.emailAddress = 'joe_doe@gmail.com'; -bodyTeamMember.phoneNumber = '+14159283333'; -bodyTeamMember.assignedLocations = bodyTeamMemberAssignedLocations; - -const body: UpdateTeamMemberRequest = {}; -body.teamMember = bodyTeamMember; + +const body: UpdateTeamMemberRequest = { + teamMember: { + referenceId: 'reference_id_1', + status: 'ACTIVE', + givenName: 'Joe', + familyName: 'Doe', + emailAddress: 'joe_doe@gmail.com', + phoneNumber: '+14159283333', + assignedLocations: { + assignmentType: 'EXPLICIT_LOCATIONS', + locationIds: [ + 'YSGH2WBKG94QZ', + 'GA2Y9HSJ8KRYT' + ], + }, + }, +}; try { - const { result, ...httpResponse } = await teamApi.updateTeamMember(teamMemberId, body); + const { result, ...httpResponse } = await teamApi.updateTeamMember( + teamMemberId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -363,11 +425,12 @@ async retrieveWageSetting( ```ts const teamMemberId = 'team_member_id0'; + try { const { result, ...httpResponse } = await teamApi.retrieveWageSetting(teamMemberId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -408,47 +471,40 @@ async updateWageSetting( ```ts const teamMemberId = 'team_member_id0'; -const contentType = null; -const bodyWageSettingJobAssignments: JobAssignment[] = []; - -const bodyWageSettingjobAssignments0AnnualRate: Money = {}; -bodyWageSettingjobAssignments0AnnualRate.amount = BigInt(3000000); -bodyWageSettingjobAssignments0AnnualRate.currency = 'USD'; - -const bodyWageSettingjobAssignments0: JobAssignment = { - jobTitle: 'Manager', - payType: 'SALARY', -}; -bodyWageSettingjobAssignments0.annualRate = bodyWageSettingjobAssignments0AnnualRate; -bodyWageSettingjobAssignments0.weeklyHours = 40; - -bodyWageSettingJobAssignments[0] = bodyWageSettingjobAssignments0; - -const bodyWageSettingjobAssignments1HourlyRate: Money = {}; -bodyWageSettingjobAssignments1HourlyRate.amount = BigInt(1200); -bodyWageSettingjobAssignments1HourlyRate.currency = 'USD'; - -const bodyWageSettingjobAssignments1: JobAssignment = { - jobTitle: 'Cashier', - payType: 'HOURLY', -}; -bodyWageSettingjobAssignments1.hourlyRate = bodyWageSettingjobAssignments1HourlyRate; - -bodyWageSettingJobAssignments[1] = bodyWageSettingjobAssignments1; - -const bodyWageSetting: WageSetting = {}; -bodyWageSetting.jobAssignments = bodyWageSettingJobAssignments; -bodyWageSetting.isOvertimeExempt = true; const body: UpdateWageSettingRequest = { - wageSetting: bodyWageSetting, + wageSetting: { + jobAssignments: [ + { + jobTitle: 'Manager', + payType: 'SALARY', + annualRate: { + amount: BigInt(3000000), + currency: 'USD', + }, + weeklyHours: 40, + }, + { + jobTitle: 'Cashier', + payType: 'HOURLY', + hourlyRate: { + amount: BigInt(1200), + currency: 'USD', + }, + } + ], + isOvertimeExempt: true, + }, }; try { - const { result, ...httpResponse } = await teamApi.updateWageSetting(teamMemberId, body); + const { result, ...httpResponse } = await teamApi.updateWageSetting( + teamMemberId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/terminal.md b/doc/api/terminal.md index 1c632edd..044a0d34 100644 --- a/doc/api/terminal.md +++ b/doc/api/terminal.md @@ -14,6 +14,7 @@ const terminalApi = client.terminalApi; * [Search Terminal Actions](../../doc/api/terminal.md#search-terminal-actions) * [Get Terminal Action](../../doc/api/terminal.md#get-terminal-action) * [Cancel Terminal Action](../../doc/api/terminal.md#cancel-terminal-action) +* [Dismiss Terminal Action](../../doc/api/terminal.md#dismiss-terminal-action) * [Create Terminal Checkout](../../doc/api/terminal.md#create-terminal-checkout) * [Search Terminal Checkouts](../../doc/api/terminal.md#search-terminal-checkouts) * [Get Terminal Checkout](../../doc/api/terminal.md#get-terminal-checkout) @@ -49,28 +50,24 @@ async createTerminalAction( ## Example Usage ```ts -const contentType = null; -const bodyActionSaveCardOptions: SaveCardOptions = { - customerId: '{{CUSTOMER_ID}}', -}; -bodyActionSaveCardOptions.referenceId = 'user-id-1'; - -const bodyAction: TerminalAction = {}; -bodyAction.deviceId = '{{DEVICE_ID}}'; -bodyAction.deadlineDuration = 'PT5M'; -bodyAction.type = 'SAVE_CARD'; -bodyAction.saveCardOptions = bodyActionSaveCardOptions; - const body: CreateTerminalActionRequest = { idempotencyKey: 'thahn-70e75c10-47f7-4ab6-88cc-aaa4076d065e', - action: bodyAction, + action: { + deviceId: '{{DEVICE_ID}}', + deadlineDuration: 'PT5M', + type: 'SAVE_CARD', + saveCardOptions: { + customerId: '{{CUSTOMER_ID}}', + referenceId: 'user-id-1', + }, + }, }; try { const { result, ...httpResponse } = await terminalApi.createTerminalAction(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -104,29 +101,25 @@ async searchTerminalActions( ## Example Usage ```ts -const contentType = null; -const bodyQueryFilterCreatedAt: TimeRange = {}; -bodyQueryFilterCreatedAt.startAt = '2022-04-01T00:00:00Z'; - -const bodyQueryFilter: TerminalActionQueryFilter = {}; -bodyQueryFilter.createdAt = bodyQueryFilterCreatedAt; - -const bodyQuerySort: TerminalActionQuerySort = {}; -bodyQuerySort.sortOrder = 'DESC'; - -const bodyQuery: TerminalActionQuery = {}; -bodyQuery.filter = bodyQueryFilter; -bodyQuery.sort = bodyQuerySort; - -const body: SearchTerminalActionsRequest = {}; -body.query = bodyQuery; -body.limit = 2; +const body: SearchTerminalActionsRequest = { + query: { + filter: { + createdAt: { + startAt: '2022-04-01T00:00:00Z', + }, + }, + sort: { + sortOrder: 'DESC', + }, + }, + limit: 2, +}; try { const { result, ...httpResponse } = await terminalApi.searchTerminalActions(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -150,7 +143,7 @@ async getTerminalAction( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `actionId` | `string` | Template, Required | Unique ID for the desired `TerminalAction` | +| `actionId` | `string` | Template, Required | Unique ID for the desired `TerminalAction`. | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | ## Response Type @@ -161,11 +154,12 @@ async getTerminalAction( ```ts const actionId = 'action_id6'; + try { const { result, ...httpResponse } = await terminalApi.getTerminalAction(actionId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -189,7 +183,7 @@ async cancelTerminalAction( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `actionId` | `string` | Template, Required | Unique ID for the desired `TerminalAction` | +| `actionId` | `string` | Template, Required | Unique ID for the desired `TerminalAction`. | | `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | ## Response Type @@ -200,11 +194,54 @@ async cancelTerminalAction( ```ts const actionId = 'action_id6'; + try { const { result, ...httpResponse } = await terminalApi.cancelTerminalAction(actionId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { + if (error instanceof ApiError) { + const errors = error.result; + // const { statusCode, headers } = error; + } +} +``` + + +# Dismiss Terminal Action + +Dismisses a Terminal action request if the status and type of the request permits it. + +See [Link and Dismiss Actions](https://developer.squareup.com/docs/terminal-api/advanced-features/custom-workflows/link-and-dismiss-actions) for more details. + +```ts +async dismissTerminalAction( + actionId: string, + requestOptions?: RequestOptions +): Promise> +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `actionId` | `string` | Template, Required | Unique ID for the `TerminalAction` associated with the waiting dialog to be dismissed. | +| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. | + +## Response Type + +[`DismissTerminalActionResponse`](../../doc/models/dismiss-terminal-action-response.md) + +## Example Usage + +```ts +const actionId = 'action_id6'; + +try { + const { result, ...httpResponse } = await terminalApi.dismissTerminalAction(actionId); + // Get more response info... + // const { statusCode, headers } = httpResponse; +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -239,32 +276,26 @@ async createTerminalCheckout( ## Example Usage ```ts -const contentType = null; -const bodyCheckoutAmountMoney: Money = {}; -bodyCheckoutAmountMoney.amount = BigInt(2610); -bodyCheckoutAmountMoney.currency = 'USD'; - -const bodyCheckoutDeviceOptions: DeviceCheckoutOptions = { - deviceId: 'dbb5d83a-7838-11ea-bc55-0242ac130003', -}; - -const bodyCheckout: TerminalCheckout = { - amountMoney: bodyCheckoutAmountMoney, - deviceOptions: bodyCheckoutDeviceOptions, -}; -bodyCheckout.referenceId = 'id11572'; -bodyCheckout.note = 'A brief note'; - const body: CreateTerminalCheckoutRequest = { idempotencyKey: '28a0c3bc-7839-11ea-bc55-0242ac130003', - checkout: bodyCheckout, + checkout: { + amountMoney: { + amount: BigInt(2610), + currency: 'USD', + }, + deviceOptions: { + deviceId: 'dbb5d83a-7838-11ea-bc55-0242ac130003', + }, + referenceId: 'id11572', + note: 'A brief note', + }, }; try { const { result, ...httpResponse } = await terminalApi.createTerminalCheckout(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -298,22 +329,20 @@ async searchTerminalCheckouts( ## Example Usage ```ts -const contentType = null; -const bodyQueryFilter: TerminalCheckoutQueryFilter = {}; -bodyQueryFilter.status = 'COMPLETED'; - -const bodyQuery: TerminalCheckoutQuery = {}; -bodyQuery.filter = bodyQueryFilter; - -const body: SearchTerminalCheckoutsRequest = {}; -body.query = bodyQuery; -body.limit = 2; +const body: SearchTerminalCheckoutsRequest = { + query: { + filter: { + status: 'COMPLETED', + }, + }, + limit: 2, +}; try { const { result, ...httpResponse } = await terminalApi.searchTerminalCheckouts(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -348,11 +377,12 @@ async getTerminalCheckout( ```ts const checkoutId = 'checkout_id8'; + try { const { result, ...httpResponse } = await terminalApi.getTerminalCheckout(checkoutId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -387,11 +417,12 @@ async cancelTerminalCheckout( ```ts const checkoutId = 'checkout_id8'; + try { const { result, ...httpResponse } = await terminalApi.cancelTerminalCheckout(checkoutId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -425,28 +456,24 @@ async createTerminalRefund( ## Example Usage ```ts -const contentType = null; -const bodyRefundAmountMoney: Money = {}; -bodyRefundAmountMoney.amount = BigInt(111); -bodyRefundAmountMoney.currency = 'CAD'; - -const bodyRefund: TerminalRefund = { - paymentId: '5O5OvgkcNUhl7JBuINflcjKqUzXZY', - amountMoney: bodyRefundAmountMoney, - reason: 'Returning items', - deviceId: 'f72dfb8e-4d65-4e56-aade-ec3fb8d33291', -}; - const body: CreateTerminalRefundRequest = { idempotencyKey: '402a640b-b26f-401f-b406-46f839590c04', + refund: { + paymentId: '5O5OvgkcNUhl7JBuINflcjKqUzXZY', + amountMoney: { + amount: BigInt(111), + currency: 'CAD', + }, + reason: 'Returning items', + deviceId: 'f72dfb8e-4d65-4e56-aade-ec3fb8d33291', + }, }; -body.refund = bodyRefund; try { const { result, ...httpResponse } = await terminalApi.createTerminalRefund(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -480,22 +507,20 @@ async searchTerminalRefunds( ## Example Usage ```ts -const contentType = null; -const bodyQueryFilter: TerminalRefundQueryFilter = {}; -bodyQueryFilter.status = 'COMPLETED'; - -const bodyQuery: TerminalRefundQuery = {}; -bodyQuery.filter = bodyQueryFilter; - -const body: SearchTerminalRefundsRequest = {}; -body.query = bodyQuery; -body.limit = 1; +const body: SearchTerminalRefundsRequest = { + query: { + filter: { + status: 'COMPLETED', + }, + }, + limit: 1, +}; try { const { result, ...httpResponse } = await terminalApi.searchTerminalRefunds(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -530,11 +555,12 @@ async getTerminalRefund( ```ts const terminalRefundId = 'terminal_refund_id0'; + try { const { result, ...httpResponse } = await terminalApi.getTerminalRefund(terminalRefundId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -569,11 +595,12 @@ async cancelTerminalRefund( ```ts const terminalRefundId = 'terminal_refund_id0'; + try { const { result, ...httpResponse } = await terminalApi.cancelTerminalRefund(terminalRefundId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/transactions.md b/doc/api/transactions.md index 71f4a8e0..65c3e793 100644 --- a/doc/api/transactions.md +++ b/doc/api/transactions.md @@ -57,11 +57,12 @@ async listTransactions( ```ts const locationId = 'location_id4'; + try { const { result, ...httpResponse } = await transactionsApi.listTransactions(locationId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -100,12 +101,17 @@ async retrieveTransaction( ```ts const locationId = 'location_id4'; + const transactionId = 'transaction_id8'; + try { - const { result, ...httpResponse } = await transactionsApi.retrieveTransaction(locationId, transactionId); + const { result, ...httpResponse } = await transactionsApi.retrieveTransaction( + locationId, + transactionId + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -148,12 +154,17 @@ async captureTransaction( ```ts const locationId = 'location_id4'; + const transactionId = 'transaction_id8'; + try { - const { result, ...httpResponse } = await transactionsApi.captureTransaction(locationId, transactionId); + const { result, ...httpResponse } = await transactionsApi.captureTransaction( + locationId, + transactionId + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -196,12 +207,17 @@ async voidTransaction( ```ts const locationId = 'location_id4'; + const transactionId = 'transaction_id8'; + try { - const { result, ...httpResponse } = await transactionsApi.voidTransaction(locationId, transactionId); + const { result, ...httpResponse } = await transactionsApi.voidTransaction( + locationId, + transactionId + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/v1-transactions.md b/doc/api/v1-transactions.md index 8ab66726..11c78e5c 100644 --- a/doc/api/v1-transactions.md +++ b/doc/api/v1-transactions.md @@ -55,11 +55,12 @@ async v1ListOrders( ```ts const locationId = 'location_id4'; + try { const { result, ...httpResponse } = await v1TransactionsApi.v1ListOrders(locationId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -98,12 +99,17 @@ async v1RetrieveOrder( ```ts const locationId = 'location_id4'; + const orderId = 'order_id6'; + try { - const { result, ...httpResponse } = await v1TransactionsApi.v1RetrieveOrder(locationId, orderId); + const { result, ...httpResponse } = await v1TransactionsApi.v1RetrieveOrder( + locationId, + orderId + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -144,17 +150,22 @@ async v1UpdateOrder( ```ts const locationId = 'location_id4'; + const orderId = 'order_id6'; -const contentType = null; + const body: V1UpdateOrderRequest = { action: 'REFUND', }; try { - const { result, ...httpResponse } = await v1TransactionsApi.v1UpdateOrder(locationId, orderId, body); + const { result, ...httpResponse } = await v1TransactionsApi.v1UpdateOrder( + locationId, + orderId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -213,12 +224,17 @@ async v1ListPayments( ```ts const locationId = 'location_id4'; + const includePartial = false; + try { - const { result, ...httpResponse } = await v1TransactionsApi.v1ListPayments(locationId, None, None, None, None, None, includePartial); + const { result, ...httpResponse } = await v1TransactionsApi.v1ListPayments( + locationId, + includePartial + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -257,12 +273,17 @@ async v1RetrievePayment( ```ts const locationId = 'location_id4'; + const paymentId = 'payment_id0'; + try { - const { result, ...httpResponse } = await v1TransactionsApi.v1RetrievePayment(locationId, paymentId); + const { result, ...httpResponse } = await v1TransactionsApi.v1RetrievePayment( + locationId, + paymentId + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -309,11 +330,12 @@ async v1ListRefunds( ```ts const locationId = 'location_id4'; + try { const { result, ...httpResponse } = await v1TransactionsApi.v1ListRefunds(locationId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -363,7 +385,7 @@ async v1CreateRefund( ```ts const locationId = 'location_id4'; -const contentType = null; + const body: V1CreateRefundRequest = { paymentId: 'payment_id6', type: 'FULL', @@ -371,10 +393,13 @@ const body: V1CreateRefundRequest = { }; try { - const { result, ...httpResponse } = await v1TransactionsApi.v1CreateRefund(locationId, body); + const { result, ...httpResponse } = await v1TransactionsApi.v1CreateRefund( + locationId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -428,11 +453,12 @@ async v1ListSettlements( ```ts const locationId = 'location_id4'; + try { const { result, ...httpResponse } = await v1TransactionsApi.v1ListSettlements(locationId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -487,12 +513,17 @@ async v1RetrieveSettlement( ```ts const locationId = 'location_id4'; + const settlementId = 'settlement_id0'; + try { - const { result, ...httpResponse } = await v1TransactionsApi.v1RetrieveSettlement(locationId, settlementId); + const { result, ...httpResponse } = await v1TransactionsApi.v1RetrieveSettlement( + locationId, + settlementId + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/vendors.md b/doc/api/vendors.md index 33615b54..13a679a3 100644 --- a/doc/api/vendors.md +++ b/doc/api/vendors.md @@ -44,17 +44,18 @@ async bulkCreateVendors( ## Example Usage ```ts -const contentType = null; -const bodyVendors: Record = {}; const body: BulkCreateVendorsRequest = { - vendors: bodyVendors, + vendors: { + 'key0': {}, + 'key1': {} + }, }; try { const { result, ...httpResponse } = await vendorsApi.bulkCreateVendors(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -88,16 +89,17 @@ async bulkRetrieveVendors( ## Example Usage ```ts -const contentType = null; -const bodyVendorIds: string[] = ['INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4']; -const body: BulkRetrieveVendorsRequest = {}; -body.vendorIds = bodyVendorIds; +const body: BulkRetrieveVendorsRequest = { + vendorIds: [ + 'INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4' + ], +}; try { const { result, ...httpResponse } = await vendorsApi.bulkRetrieveVendors(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -131,17 +133,22 @@ async bulkUpdateVendors( ## Example Usage ```ts -const contentType = null; -const bodyVendors: Record = {}; const body: BulkUpdateVendorsRequest = { - vendors: bodyVendors, + vendors: { + 'key0': { + vendor: {}, + }, + 'key1': { + vendor: {}, + } + }, }; try { const { result, ...httpResponse } = await vendorsApi.bulkUpdateVendors(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -175,7 +182,6 @@ async createVendor( ## Example Usage ```ts -const contentType = null; const body: CreateVendorRequest = { idempotencyKey: 'idempotency_key2', }; @@ -184,7 +190,7 @@ try { const { result, ...httpResponse } = await vendorsApi.createVendor(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -218,14 +224,13 @@ async searchVendors( ## Example Usage ```ts -const contentType = null; const body: SearchVendorsRequest = {}; try { const { result, ...httpResponse } = await vendorsApi.searchVendors(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -260,11 +265,12 @@ async retrieveVendor( ```ts const vendorId = 'vendor_id8'; + try { const { result, ...httpResponse } = await vendorsApi.retrieveVendor(vendorId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -300,24 +306,26 @@ async updateVendor( ## Example Usage ```ts -const contentType = null; -const bodyVendor: Vendor = {}; -bodyVendor.id = 'INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4'; -bodyVendor.name = 'Jack\'s Chicken Shack'; -bodyVendor.version = 1; -bodyVendor.status = 'ACTIVE'; - const body: UpdateVendorRequest = { - vendor: bodyVendor, + vendor: { + id: 'INV_V_JDKYHBWT1D4F8MFH63DBMEN8Y4', + name: 'Jack\'s Chicken Shack', + version: 1, + status: 'ACTIVE', + }, + idempotencyKey: '8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe', }; -body.idempotencyKey = '8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe'; const vendorId = 'vendor_id8'; + try { - const { result, ...httpResponse } = await vendorsApi.updateVendor(body, vendorId); + const { result, ...httpResponse } = await vendorsApi.updateVendor( + body, + vendorId + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/api/webhook-subscriptions.md b/doc/api/webhook-subscriptions.md index 0380c443..467e5ed1 100644 --- a/doc/api/webhook-subscriptions.md +++ b/doc/api/webhook-subscriptions.md @@ -49,7 +49,7 @@ try { const { result, ...httpResponse } = await webhookSubscriptionsApi.listWebhookEventTypes(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -90,11 +90,14 @@ async listWebhookSubscriptions( ```ts const includeDisabled = false; + try { - const { result, ...httpResponse } = await webhookSubscriptionsApi.listWebhookSubscriptions(None, includeDisabled); + const { result, ...httpResponse } = await webhookSubscriptionsApi.listWebhookSubscriptions( + includeDisabled + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -128,24 +131,24 @@ async createWebhookSubscription( ## Example Usage ```ts -const contentType = null; -const bodySubscriptionEventTypes: string[] = ['payment.created', 'payment.updated']; -const bodySubscription: WebhookSubscription = {}; -bodySubscription.name = 'Example Webhook Subscription'; -bodySubscription.eventTypes = bodySubscriptionEventTypes; -bodySubscription.notificationUrl = 'https://example-webhook-url.com'; -bodySubscription.apiVersion = '2021-12-15'; - const body: CreateWebhookSubscriptionRequest = { - subscription: bodySubscription, + subscription: { + name: 'Example Webhook Subscription', + eventTypes: [ + 'payment.created', + 'payment.updated' + ], + notificationUrl: 'https://example-webhook-url.com', + apiVersion: '2021-12-15', + }, + idempotencyKey: '63f84c6c-2200-4c99-846c-2670a1311fbf', }; -body.idempotencyKey = '63f84c6c-2200-4c99-846c-2670a1311fbf'; try { const { result, ...httpResponse } = await webhookSubscriptionsApi.createWebhookSubscription(body); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -180,11 +183,12 @@ async deleteWebhookSubscription( ```ts const subscriptionId = 'subscription_id0'; + try { const { result, ...httpResponse } = await webhookSubscriptionsApi.deleteWebhookSubscription(subscriptionId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -219,11 +223,12 @@ async retrieveWebhookSubscription( ```ts const subscriptionId = 'subscription_id0'; + try { const { result, ...httpResponse } = await webhookSubscriptionsApi.retrieveWebhookSubscription(subscriptionId); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -260,19 +265,22 @@ async updateWebhookSubscription( ```ts const subscriptionId = 'subscription_id0'; -const contentType = null; -const bodySubscription: WebhookSubscription = {}; -bodySubscription.name = 'Updated Example Webhook Subscription'; -bodySubscription.enabled = false; -const body: UpdateWebhookSubscriptionRequest = {}; -body.subscription = bodySubscription; +const body: UpdateWebhookSubscriptionRequest = { + subscription: { + name: 'Updated Example Webhook Subscription', + enabled: false, + }, +}; try { - const { result, ...httpResponse } = await webhookSubscriptionsApi.updateWebhookSubscription(subscriptionId, body); + const { result, ...httpResponse } = await webhookSubscriptionsApi.updateWebhookSubscription( + subscriptionId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -309,15 +317,19 @@ async updateWebhookSubscriptionSignatureKey( ```ts const subscriptionId = 'subscription_id0'; -const contentType = null; -const body: UpdateWebhookSubscriptionSignatureKeyRequest = {}; -body.idempotencyKey = 'ed80ae6b-0654-473b-bbab-a39aee89a60d'; + +const body: UpdateWebhookSubscriptionSignatureKeyRequest = { + idempotencyKey: 'ed80ae6b-0654-473b-bbab-a39aee89a60d', +}; try { - const { result, ...httpResponse } = await webhookSubscriptionsApi.updateWebhookSubscriptionSignatureKey(subscriptionId, body); + const { result, ...httpResponse } = await webhookSubscriptionsApi.updateWebhookSubscriptionSignatureKey( + subscriptionId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; @@ -354,15 +366,19 @@ async testWebhookSubscription( ```ts const subscriptionId = 'subscription_id0'; -const contentType = null; -const body: TestWebhookSubscriptionRequest = {}; -body.eventType = 'payment.created'; + +const body: TestWebhookSubscriptionRequest = { + eventType: 'payment.created', +}; try { - const { result, ...httpResponse } = await webhookSubscriptionsApi.testWebhookSubscription(subscriptionId, body); + const { result, ...httpResponse } = await webhookSubscriptionsApi.testWebhookSubscription( + subscriptionId, + body + ); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/client.md b/doc/client.md index da8ddad9..6eea0810 100644 --- a/doc/client.md +++ b/doc/client.md @@ -5,7 +5,7 @@ The following parameters are configurable for the API Client: | Parameter | Type | Description | | --- | --- | --- | -| `squareVersion` | `string` | Square Connect API versions
*Default*: `'2023-05-17'` | +| `squareVersion` | `string` | Square Connect API versions
*Default*: `'2023-06-08'` | | `customUrl` | `string` | Sets the base URL requests are made to. Defaults to `https://connect.squareup.com`
*Default*: `'https://connect.squareup.com'` | | `environment` | `string` | The API environment.
**Default: `production`** | | `additionalHeaders` | `Readonly>` | Additional headers to add to each API call
*Default*: `{}` | @@ -40,7 +40,7 @@ The API client can be initialized as follows: ```ts const client = new Client({ - squareVersion: '2023-05-17', + squareVersion: '2023-06-08', timeout: 60000, additionalHeaders: {}, userAgentDetail: '', @@ -55,18 +55,20 @@ const client = new Client({ import { ApiError, Client } from 'square'; const client = new Client({ - squareVersion: '2023-05-17', + squareVersion: '2023-06-08', timeout: 60000, additionalHeaders: {}, userAgentDetail: '', accessToken: 'AccessToken', }); + const locationsApi = client.locationsApi; + try { const { result, ...httpResponse } = await locationsApi.listLocations(); // Get more response info... // const { statusCode, headers } = httpResponse; -} catch(error) { +} catch (error) { if (error instanceof ApiError) { const errors = error.result; // const { statusCode, headers } = error; diff --git a/doc/models/activity-type.md b/doc/models/activity-type.md index 83b0b11c..f2157dcf 100644 --- a/doc/models/activity-type.md +++ b/doc/models/activity-type.md @@ -44,4 +44,8 @@ | `THIRD_PARTY_FEE` | Fees collected by a third-party platform. | | `THIRD_PARTY_FEE_REFUND` | Refunded fees from a third-party platform. | | `PAYOUT` | Balance change due to money transfer. | +| `AUTOMATIC_BITCOIN_CONVERSIONS` | Indicates the withholding of a portion of each payment by Square that has been
automatically converted into bitcoin using Cash App. The seller manages their bitcoin in
their Cash App account. | +| `AUTOMATIC_BITCOIN_CONVERSIONS_REVERSED` | Indicates a return of the payment withholding that had been scheduled to be converted
into bitcoin using Cash App to the Square payments balance. | +| `CREDIT_CARD_REPAYMENT` | The repayment made toward the outstanding balance on the seller's Square credit card. | +| `CREDIT_CARD_REPAYMENT_REVERSED` | The reversal of the repayment made toward the outstanding balance on the seller's
Square credit card. | diff --git a/doc/models/cancel-subscription-response.md b/doc/models/cancel-subscription-response.md index 1ef88548..b03146c2 100644 --- a/doc/models/cancel-subscription-response.md +++ b/doc/models/cancel-subscription-response.md @@ -13,7 +13,7 @@ Defines output parameters in a response from the | Name | Type | Tags | Description | | --- | --- | --- | --- | | `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors encountered during the request. | -| `subscription` | [`Subscription \| undefined`](../../doc/models/subscription.md) | Optional | Represents a subscription to a subscription plan by a subscriber.

For an overview of the `Subscription` type, see
[Subscription object](https://developer.squareup.com/docs/subscriptions-api/overview#subscription-object-overview). | +| `subscription` | [`Subscription \| undefined`](../../doc/models/subscription.md) | Optional | Represents a subscription purchased by a customer.

For more information, see
[Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). | | `actions` | [`SubscriptionAction[] \| undefined`](../../doc/models/subscription-action.md) | Optional | A list of a single `CANCEL` action scheduled for the subscription. | ## Example (as JSON) @@ -35,7 +35,8 @@ Defines output parameters in a response from the "start_date": "2021-10-20", "status": "ACTIVE", "timezone": "America/Los_Angeles", - "version": 1594311617331 + "version": 1594311617331, + "plan_variation_id": "plan_variation_id8" }, "errors": [ { @@ -62,19 +63,61 @@ Defines output parameters in a response from the "id": "id9", "type": "PAUSE", "effective_date": "effective_date1", - "new_plan_id": "new_plan_id5" + "phases": [ + { + "uid": "uid6", + "ordinal": 186, + "order_template_id": "order_template_id8", + "plan_phase_uid": "plan_phase_uid2" + } + ], + "new_plan_variation_id": "new_plan_variation_id9" }, { "id": "id0", "type": "CANCEL", "effective_date": "effective_date0", - "new_plan_id": "new_plan_id6" + "phases": [ + { + "uid": "uid5", + "ordinal": 185, + "order_template_id": "order_template_id7", + "plan_phase_uid": "plan_phase_uid1" + }, + { + "uid": "uid6", + "ordinal": 186, + "order_template_id": "order_template_id8", + "plan_phase_uid": "plan_phase_uid2" + }, + { + "uid": "uid7", + "ordinal": 187, + "order_template_id": "order_template_id9", + "plan_phase_uid": "plan_phase_uid3" + } + ], + "new_plan_variation_id": "new_plan_variation_id0" }, { "id": "id1", "type": "SWAP_PLAN", "effective_date": "effective_date9", - "new_plan_id": "new_plan_id7" + "phases": [ + { + "uid": "uid4", + "ordinal": 184, + "order_template_id": "order_template_id6", + "plan_phase_uid": "plan_phase_uid0" + }, + { + "uid": "uid5", + "ordinal": 185, + "order_template_id": "order_template_id7", + "plan_phase_uid": "plan_phase_uid1" + } + ], + "new_plan_variation_id": "new_plan_variation_id1" } ] } diff --git a/doc/models/cancel-terminal-checkout-response.md b/doc/models/cancel-terminal-checkout-response.md index b81366ed..8d2e41ba 100644 --- a/doc/models/cancel-terminal-checkout-response.md +++ b/doc/models/cancel-terminal-checkout-response.md @@ -24,7 +24,7 @@ "app_id": "APP_ID", "cancel_reason": "SELLER_CANCELED", "created_at": "2020-03-16T15:31:19.934Z", - "deadline_duration": "PT10M", + "deadline_duration": "PT5M", "device_options": { "device_id": "dbb5d83a-7838-11ea-bc55-0242ac130003", "skip_receipt_screen": true, diff --git a/doc/models/catalog-custom-attribute-definition.md b/doc/models/catalog-custom-attribute-definition.md index 11b5eed2..5aaa2dbb 100644 --- a/doc/models/catalog-custom-attribute-definition.md +++ b/doc/models/catalog-custom-attribute-definition.md @@ -41,9 +41,9 @@ to store any sensitive information (personally identifiable information, card de "name": "name2" }, "allowed_object_types": [ - "PRICING_RULE", - "PRODUCT_SET", - "TIME_PERIOD" + "TIME_PERIOD", + "MEASUREMENT_UNIT", + "SUBSCRIPTION_PLAN_VARIATION" ], "seller_visibility": "SELLER_VISIBILITY_HIDDEN", "app_visibility": "APP_VISIBILITY_HIDDEN", diff --git a/doc/models/catalog-item-option.md b/doc/models/catalog-item-option.md index cb85c012..92232c42 100644 --- a/doc/models/catalog-item-option.md +++ b/doc/models/catalog-item-option.md @@ -27,7 +27,7 @@ A group of variations for a `CatalogItem`. "show_colors": false, "values": [ { - "type": "MODIFIER", + "type": "TAX", "id": "id0", "updated_at": "updated_at6", "version": 100, @@ -71,7 +71,7 @@ A group of variations for a `CatalogItem`. ] }, { - "type": "MODIFIER_LIST", + "type": "ITEM_VARIATION", "id": "id1", "updated_at": "updated_at7", "version": 101, @@ -100,7 +100,7 @@ A group of variations for a `CatalogItem`. ] }, { - "type": "DISCOUNT", + "type": "CATEGORY", "id": "id2", "updated_at": "updated_at8", "version": 102, diff --git a/doc/models/catalog-modifier-list.md b/doc/models/catalog-modifier-list.md index 79b65987..2a9153a0 100644 --- a/doc/models/catalog-modifier-list.md +++ b/doc/models/catalog-modifier-list.md @@ -74,7 +74,7 @@ the modifier list are allowed. "selection_type": "SINGLE", "modifiers": [ { - "type": "CATEGORY", + "type": "DISCOUNT", "id": "id1", "updated_at": "updated_at7", "version": 145, @@ -100,7 +100,7 @@ the modifier list are allowed. ] }, { - "type": "IMAGE", + "type": "TAX", "id": "id2", "updated_at": "updated_at8", "version": 146, diff --git a/doc/models/catalog-object-batch.md b/doc/models/catalog-object-batch.md index 703d5d8d..49191516 100644 --- a/doc/models/catalog-object-batch.md +++ b/doc/models/catalog-object-batch.md @@ -19,7 +19,7 @@ A batch of catalog objects. { "objects": [ { - "type": "CUSTOM_ATTRIBUTE_DEFINITION", + "type": "MODIFIER_LIST", "id": "id8", "item_data": { "object": { diff --git a/doc/models/catalog-object-type.md b/doc/models/catalog-object-type.md index 918c58b7..d817fb24 100644 --- a/doc/models/catalog-object-type.md +++ b/doc/models/catalog-object-type.md @@ -24,6 +24,7 @@ containing type-specific properties in the `*_data` field corresponding to the s | `PRODUCT_SET` | The `CatalogObject` instance is of the [CatalogProductSet](../../doc/models/catalog-product-set.md) type and represents a product set.
The product-set-specific data will be stored in the `product_set_data` field. | | `TIME_PERIOD` | The `CatalogObject` instance is of the [CatalogTimePeriod](../../doc/models/catalog-time-period.md) type and represents a time period.
The time-period-specific data must be set on the `time_period_data` field. | | `MEASUREMENT_UNIT` | The `CatalogObject` instance is of the [CatalogMeasurementUnit](../../doc/models/catalog-measurement-unit.md) type and represents a measurement unit specifying the unit of
measure and precision in which an item variation is sold. The measurement-unit-specific data must set on the `measurement_unit_data` field. | +| `SUBSCRIPTION_PLAN_VARIATION` | The `CatalogObject` instance is of the [CatalogSubscriptionPlan](../../doc/models/catalog-subscription-plan.md) type and represents a subscription plan.
The subscription-plan-specific data must be stored on the `subscription_plan_data` field. | | `ITEM_OPTION` | The `CatalogObject` instance is of the [CatalogItemOption](../../doc/models/catalog-item-option.md) type and represents a list of options (such as a color or size of a T-shirt)
that can be assigned to item variations. The item-option-specific data must be on the `item_option_data` field. | | `ITEM_OPTION_VAL` | The `CatalogObject` instance is of the [CatalogItemOptionValue](../../doc/models/catalog-item-option-value.md) type and represents a value associated with one or more item options.
For example, an item option of "Size" may have item option values such as "Small" or "Medium".
The item-option-value-specific data must be on the `item_option_value_data` field. | | `CUSTOM_ATTRIBUTE_DEFINITION` | The `CatalogObject` instance is of the [CatalogCustomAttributeDefinition](../../doc/models/catalog-custom-attribute-definition.md) type and represents the definition of a custom attribute.
The custom-attribute-definition-specific data must be set on the `custom_attribute_definition_data` field. | diff --git a/doc/models/catalog-object.md b/doc/models/catalog-object.md index cd4e3b98..b5310b09 100644 --- a/doc/models/catalog-object.md +++ b/doc/models/catalog-object.md @@ -42,7 +42,7 @@ For a more detailed discussion of the Catalog data model, please see the | `pricingRuleData` | [`CatalogPricingRule \| undefined`](../../doc/models/catalog-pricing-rule.md) | Optional | Defines how discounts are automatically applied to a set of items that match the pricing rule
during the active time period. | | `imageData` | [`CatalogImage \| undefined`](../../doc/models/catalog-image.md) | Optional | An image file to use in Square catalogs. It can be associated with
`CatalogItem`, `CatalogItemVariation`, `CatalogCategory`, and `CatalogModifierList` objects.
Only the images on items and item variations are exposed in Dashboard.
Only the first image on an item is displayed in Square Point of Sale (SPOS).
Images on items and variations are displayed through Square Online Store.
Images on other object types are for use by 3rd party application developers. | | `measurementUnitData` | [`CatalogMeasurementUnit \| undefined`](../../doc/models/catalog-measurement-unit.md) | Optional | Represents the unit used to measure a `CatalogItemVariation` and
specifies the precision for decimal quantities. | -| `subscriptionPlanData` | [`CatalogSubscriptionPlan \| undefined`](../../doc/models/catalog-subscription-plan.md) | Optional | Describes a subscription plan. For more information, see
[Set Up and Manage a Subscription Plan](https://developer.squareup.com/docs/subscriptions-api/setup-plan). | +| `subscriptionPlanData` | [`CatalogSubscriptionPlan \| undefined`](../../doc/models/catalog-subscription-plan.md) | Optional | Describes a subscription plan. A subscription plan represents what you want to sell in a subscription model, and includes references to each of the associated subscription plan variations.
For more information, see [Subscription Plans and Variations](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations). | | `itemOptionData` | [`CatalogItemOption \| undefined`](../../doc/models/catalog-item-option.md) | Optional | A group of variations for a `CatalogItem`. | | `itemOptionValueData` | [`CatalogItemOptionValue \| undefined`](../../doc/models/catalog-item-option-value.md) | Optional | An enumerated value that can link a
`CatalogItemVariation` to an item option as one of
its item option values. | | `customAttributeDefinitionData` | [`CatalogCustomAttributeDefinition \| undefined`](../../doc/models/catalog-custom-attribute-definition.md) | Optional | Contains information defining a custom attribute. Custom attributes are
intended to store additional information about a catalog object or to associate a
catalog object with an entity in another system. Do not use custom attributes
to store any sensitive information (personally identifiable information, card details, etc.).
[Read more about custom attributes](https://developer.squareup.com/docs/catalog-api/add-custom-attributes) | @@ -52,7 +52,7 @@ For a more detailed discussion of the Catalog data model, please see the ```json { - "type": "ITEM_VARIATION", + "type": "CATEGORY", "id": "id0", "item_data": { "object": { diff --git a/doc/models/catalog-subscription-plan-variation.md b/doc/models/catalog-subscription-plan-variation.md new file mode 100644 index 00000000..b52d6faa --- /dev/null +++ b/doc/models/catalog-subscription-plan-variation.md @@ -0,0 +1,51 @@ + +# Catalog Subscription Plan Variation + +Describes a subscription plan variation. A subscription plan variation represents how the subscription for a product or service is sold. +For more information, see [Subscription Plans and Variations](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations). + +## Structure + +`CatalogSubscriptionPlanVariation` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `name` | `string` | Required | The name of the plan variation. | +| `phases` | [`SubscriptionPhase[]`](../../doc/models/subscription-phase.md) | Required | A list containing each [SubscriptionPhase](entity:SubscriptionPhase) for this plan variation. | +| `subscriptionPlanId` | `string \| undefined` | Optional | The id of the subscription plan, if there is one. | + +## Example (as JSON) + +```json +{ + "name": "name0", + "phases": [ + { + "uid": "uid5", + "cadence": "EVERY_FOUR_MONTHS", + "periods": 241, + "recurring_price_money": { + "amount": 193, + "currency": "MOP" + }, + "ordinal": 207, + "pricing": { + "type": "RELATIVE", + "discount_ids": [ + "discount_ids0", + "discount_ids1", + "discount_ids2" + ], + "price_money": { + "amount": 251, + "currency": "SLL" + } + } + } + ], + "subscription_plan_id": "subscription_plan_id2" +} +``` + diff --git a/doc/models/catalog-subscription-plan.md b/doc/models/catalog-subscription-plan.md index 4ecff280..23c55773 100644 --- a/doc/models/catalog-subscription-plan.md +++ b/doc/models/catalog-subscription-plan.md @@ -1,8 +1,8 @@ # Catalog Subscription Plan -Describes a subscription plan. For more information, see -[Set Up and Manage a Subscription Plan](https://developer.squareup.com/docs/subscriptions-api/setup-plan). +Describes a subscription plan. A subscription plan represents what you want to sell in a subscription model, and includes references to each of the associated subscription plan variations. +For more information, see [Subscription Plans and Variations](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations). ## Structure @@ -14,6 +14,10 @@ Describes a subscription plan. For more information, see | --- | --- | --- | --- | | `name` | `string` | Required | The name of the plan. | | `phases` | [`SubscriptionPhase[] \| undefined`](../../doc/models/subscription-phase.md) | Optional | A list of SubscriptionPhase containing the [SubscriptionPhase](entity:SubscriptionPhase) for this plan.
This field it required. Not including this field will throw a REQUIRED_FIELD_MISSING error | +| `subscriptionPlanVariations` | [`CatalogObject[] \| undefined`](../../doc/models/catalog-object.md) | Optional | The list of subscription plan variations available for this product | +| `eligibleItemIds` | `string[] \| undefined` | Optional | The list of IDs of `CatalogItems` that are eligible for subscription by this SubscriptionPlan's variations. | +| `eligibleCategoryIds` | `string[] \| undefined` | Optional | The list of IDs of `CatalogCategory` that are eligible for subscription by this SubscriptionPlan's variations. | +| `allItems` | `boolean \| undefined` | Optional | If true, all items in the merchant's catalog are subscribable by this SubscriptionPlan. | ## Example (as JSON) @@ -29,7 +33,19 @@ Describes a subscription plan. For more information, see "amount": 193, "currency": "MOP" }, - "ordinal": 207 + "ordinal": 207, + "pricing": { + "type": "RELATIVE", + "discount_ids": [ + "discount_ids0", + "discount_ids1", + "discount_ids2" + ], + "price_money": { + "amount": 251, + "currency": "SLL" + } + } }, { "uid": "uid6", @@ -39,9 +55,84 @@ Describes a subscription plan. For more information, see "amount": 194, "currency": "MRO" }, - "ordinal": 208 + "ordinal": 208, + "pricing": { + "type": "STATIC", + "discount_ids": [ + "discount_ids9", + "discount_ids0" + ], + "price_money": { + "amount": 252, + "currency": "SOS" + } + } } - ] + ], + "subscription_plan_variations": [ + { + "type": "MODIFIER_LIST", + "id": "id2", + "updated_at": "updated_at2", + "version": 18, + "is_deleted": false, + "custom_attribute_values": { + "key0": { + "name": "name7", + "string_value": "string_value1", + "custom_attribute_definition_id": "custom_attribute_definition_id5", + "type": "SELECTION", + "number_value": "number_value7" + }, + "key1": { + "name": "name8", + "string_value": "string_value2", + "custom_attribute_definition_id": "custom_attribute_definition_id4", + "type": "NUMBER", + "number_value": "number_value8" + } + }, + "catalog_v1_ids": [ + { + "catalog_v1_id": "catalog_v1_id6", + "location_id": "location_id6" + } + ] + }, + { + "type": "DISCOUNT", + "id": "id3", + "updated_at": "updated_at1", + "version": 19, + "is_deleted": true, + "custom_attribute_values": { + "key0": { + "name": "name6", + "string_value": "string_value0", + "custom_attribute_definition_id": "custom_attribute_definition_id6", + "type": "STRING", + "number_value": "number_value6" + } + }, + "catalog_v1_ids": [ + { + "catalog_v1_id": "catalog_v1_id7", + "location_id": "location_id7" + }, + { + "catalog_v1_id": "catalog_v1_id8", + "location_id": "location_id8" + } + ] + } + ], + "eligible_item_ids": [ + "eligible_item_ids8" + ], + "eligible_category_ids": [ + "eligible_category_ids7" + ], + "all_items": false } ``` diff --git a/doc/models/checkout-options.md b/doc/models/checkout-options.md index 7a52c96d..f2bf0a41 100644 --- a/doc/models/checkout-options.md +++ b/doc/models/checkout-options.md @@ -18,6 +18,8 @@ | `acceptedPaymentMethods` | [`AcceptedPaymentMethods \| undefined`](../../doc/models/accepted-payment-methods.md) | Optional | - | | `appFeeMoney` | [`Money \| undefined`](../../doc/models/money.md) | Optional | Represents an amount of money. `Money` fields can be signed or unsigned.
Fields that do not explicitly define whether they are signed or unsigned are
considered unsigned and can only hold positive amounts. For signed fields, the
sign of the value indicates the purpose of the money transfer. See
[Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)
for more information. | | `shippingFee` | [`ShippingFee \| undefined`](../../doc/models/shipping-fee.md) | Optional | - | +| `enableCoupon` | `boolean \| undefined` | Optional | Indicates whether to include the `Add coupon` section for the buyer to provide a Square marketing coupon in the payment form. | +| `enableLoyalty` | `boolean \| undefined` | Optional | Indicates whether to include the `REWARDS` section for the buyer to opt in to loyalty, redeem rewards in the payment form, or both. | ## Example (as JSON) diff --git a/doc/models/collected-data.md b/doc/models/collected-data.md new file mode 100644 index 00000000..7cda133f --- /dev/null +++ b/doc/models/collected-data.md @@ -0,0 +1,21 @@ + +# Collected Data + +## Structure + +`CollectedData` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `inputText` | `string \| undefined` | Optional | The buyer's input text. | + +## Example (as JSON) + +```json +{ + "input_text": "input_text8" +} +``` + diff --git a/doc/models/confirmation-decision.md b/doc/models/confirmation-decision.md new file mode 100644 index 00000000..357eb84f --- /dev/null +++ b/doc/models/confirmation-decision.md @@ -0,0 +1,21 @@ + +# Confirmation Decision + +## Structure + +`ConfirmationDecision` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `hasAgreed` | `boolean \| undefined` | Optional | The buyer's decision to the displayed terms. | + +## Example (as JSON) + +```json +{ + "has_agreed": false +} +``` + diff --git a/doc/models/confirmation-options.md b/doc/models/confirmation-options.md new file mode 100644 index 00000000..1f629028 --- /dev/null +++ b/doc/models/confirmation-options.md @@ -0,0 +1,31 @@ + +# Confirmation Options + +## Structure + +`ConfirmationOptions` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `title` | `string` | Required | The title text to display in the confirmation screen flow on the Terminal.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `250` | +| `body` | `string` | Required | The agreement details to display in the confirmation flow on the Terminal.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `10000` | +| `agreeButtonText` | `string` | Required | The button text to display indicating the customer agrees to the displayed terms.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `250` | +| `disagreeButtonText` | `string \| undefined` | Optional | The button text to display indicating the customer does not agree to the displayed terms.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `250` | +| `decision` | [`ConfirmationDecision \| undefined`](../../doc/models/confirmation-decision.md) | Optional | - | + +## Example (as JSON) + +```json +{ + "title": "title4", + "body": "body6", + "agree_button_text": "agree_button_text4", + "disagree_button_text": "disagree_button_text4", + "decision": { + "has_agreed": false + } +} +``` + diff --git a/doc/models/create-mobile-authorization-code-response.md b/doc/models/create-mobile-authorization-code-response.md index df2c3c6a..22505aa0 100644 --- a/doc/models/create-mobile-authorization-code-response.md +++ b/doc/models/create-mobile-authorization-code-response.md @@ -14,7 +14,7 @@ a request to the `CreateMobileAuthorizationCode` endpoint. | --- | --- | --- | --- | | `authorizationCode` | `string \| undefined` | Optional | The generated authorization code that connects a mobile application instance
to a Square account.
**Constraints**: *Maximum Length*: `191` | | `expiresAt` | `string \| undefined` | Optional | The timestamp when `authorization_code` expires, in
[RFC 3339](https://tools.ietf.org/html/rfc3339) format (for example, "2016-09-04T23:59:33.123Z").
**Constraints**: *Minimum Length*: `20`, *Maximum Length*: `48` | -| `error` | [`Error \| undefined`](../../doc/models/error.md) | Optional | Represents an error encountered during a request to the Connect API.

See [Handling errors](https://developer.squareup.com/docs/build-basics/handling-errors) for more information. | +| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | ## Example (as JSON) @@ -22,12 +22,26 @@ a request to the `CreateMobileAuthorizationCode` endpoint. { "authorization_code": "YOUR_MOBILE_AUTHORIZATION_CODE", "expires_at": "2019-01-10T19:42:08Z", - "error": { - "category": "API_ERROR", - "code": "ADDRESS_VERIFICATION_FAILURE", - "detail": "detail0", - "field": "field8" - } + "errors": [ + { + "category": "AUTHENTICATION_ERROR", + "code": "REFUND_ALREADY_PENDING", + "detail": "detail1", + "field": "field9" + }, + { + "category": "INVALID_REQUEST_ERROR", + "code": "PAYMENT_NOT_REFUNDABLE", + "detail": "detail2", + "field": "field0" + }, + { + "category": "RATE_LIMIT_ERROR", + "code": "REFUND_DECLINED", + "detail": "detail3", + "field": "field1" + } + ] } ``` diff --git a/doc/models/create-payment-link-response.md b/doc/models/create-payment-link-response.md index 02236aa3..7f0afa82 100644 --- a/doc/models/create-payment-link-response.md +++ b/doc/models/create-payment-link-response.md @@ -128,7 +128,7 @@ ], "subscription_plans": [ { - "type": "TAX", + "type": "PRICING_RULE", "id": "id0", "updated_at": "updated_at6", "version": 172, @@ -165,7 +165,7 @@ ] }, { - "type": "DISCOUNT", + "type": "PRODUCT_SET", "id": "id1", "updated_at": "updated_at7", "version": 173, @@ -201,7 +201,7 @@ ] }, { - "type": "MODIFIER_LIST", + "type": "TIME_PERIOD", "id": "id2", "updated_at": "updated_at8", "version": 174, diff --git a/doc/models/create-subscription-request.md b/doc/models/create-subscription-request.md index e978e659..5fda2753 100644 --- a/doc/models/create-subscription-request.md +++ b/doc/models/create-subscription-request.md @@ -12,17 +12,19 @@ Defines input parameters in a request to the | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `idempotencyKey` | `string \| undefined` | Optional | A unique string that identifies this `CreateSubscription` request.
If you do not provide a unique string (or provide an empty string as the value),
the endpoint treats each request as independent.

For more information, see [Idempotency keys](https://developer.squareup.com/docs/working-with-apis/idempotency). | +| `idempotencyKey` | `string \| undefined` | Optional | A unique string that identifies this `CreateSubscription` request.
If you do not provide a unique string (or provide an empty string as the value),
the endpoint treats each request as independent.

For more information, see [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). | | `locationId` | `string` | Required | The ID of the location the subscription is associated with.
**Constraints**: *Minimum Length*: `1` | -| `planId` | `string` | Required | The ID of the subscription plan created using the Catalog API.
For more information, see
[Set Up and Manage a Subscription Plan](https://developer.squareup.com/docs/subscriptions-api/setup-plan) and
[Subscriptions Walkthrough](https://developer.squareup.com/docs/subscriptions-api/walkthrough).
**Constraints**: *Minimum Length*: `1` | -| `customerId` | `string` | Required | The ID of the [customer](entity:Customer) subscribing to the subscription plan.
**Constraints**: *Minimum Length*: `1` | +| `planId` | `string \| undefined` | Optional | The ID of the [subscription plan](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations) created using the Catalog API.

Deprecated in favour of `plan_variation_id`.

For more information, see
[Set Up and Manage a Subscription Plan](https://developer.squareup.com/docs/subscriptions-api/setup-plan) and
[Subscriptions Walkthrough](https://developer.squareup.com/docs/subscriptions-api/walkthrough). | +| `planVariationId` | `string \| undefined` | Optional | The ID of the [subscription plan variation](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations#plan-variations) created using the Catalog API. | +| `customerId` | `string` | Required | The ID of the [customer](entity:Customer) subscribing to the subscription plan variation.
**Constraints**: *Minimum Length*: `1` | | `startDate` | `string \| undefined` | Optional | The `YYYY-MM-DD`-formatted date to start the subscription.
If it is unspecified, the subscription starts immediately. | -| `canceledDate` | `string \| undefined` | Optional | The `YYYY-MM-DD`-formatted date when the newly created subscription is scheduled for cancellation.

This date overrides the cancellation date set in the plan configuration.
If the cancellation date is earlier than the end date of a subscription cycle, the subscription stops
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 expires, the specified `canceled_date` sets the date when the subscription
stops through the end of the last cycle. | +| `canceledDate` | `string \| undefined` | Optional | The `YYYY-MM-DD`-formatted date when the newly created subscription is scheduled for cancellation.

This date overrides the cancellation date set in the plan variation configuration.
If the cancellation date is earlier than the end date of a subscription cycle, the subscription stops
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 expires, the specified `canceled_date` sets the date when the subscription
stops through the end of the last cycle. | | `taxPercentage` | `string \| undefined` | Optional | The tax to add when billing the subscription.
The percentage is expressed in decimal form, using a `'.'` as the decimal
separator and without a `'%'` sign. For example, a value of 7.5
corresponds to 7.5%.
**Constraints**: *Maximum Length*: `10` | | `priceOverrideMoney` | [`Money \| undefined`](../../doc/models/money.md) | Optional | Represents an amount of money. `Money` fields can be signed or unsigned.
Fields that do not explicitly define whether they are signed or unsigned are
considered unsigned and can only hold positive amounts. For signed fields, the
sign of the value indicates the purpose of the money transfer. See
[Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)
for more information. | -| `cardId` | `string \| undefined` | Optional | The ID of the [subscriber's](entity:Customer) [card](entity:Card) to charge.
If it is not specified, the subscriber receives an invoice via email. For an example to
create a customer profile for a subscriber and add a card on file, see [Subscriptions Walkthrough](https://developer.squareup.com/docs/subscriptions-api/walkthrough). | +| `cardId` | `string \| undefined` | Optional | The ID of the [subscriber's](entity:Customer) [card](entity:Card) to charge.
If it is not specified, the subscriber receives an invoice via email with a link to pay for their subscription. | | `timezone` | `string \| undefined` | Optional | The timezone that is used in date calculations for the subscription. If unset, defaults to
the location timezone. If a timezone is not configured for the location, defaults to "America/New_York".
Format: the IANA Timezone Database identifier for the location timezone. For
a list of time zones, see [List of tz database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). | | `source` | [`SubscriptionSource \| undefined`](../../doc/models/subscription-source.md) | Optional | The origination details of the subscription. | +| `phases` | [`Phase[] \| undefined`](../../doc/models/phase.md) | Optional | array of phases for this subscription | ## Example (as JSON) @@ -43,6 +45,7 @@ Defines input parameters in a request to the "start_date": "2021-10-20", "tax_percentage": "5", "timezone": "America/Los_Angeles", + "plan_variation_id": "plan_variation_id4", "canceled_date": "canceled_date6" } ``` diff --git a/doc/models/create-subscription-response.md b/doc/models/create-subscription-response.md index 9d6a6ae1..874a041c 100644 --- a/doc/models/create-subscription-response.md +++ b/doc/models/create-subscription-response.md @@ -13,7 +13,7 @@ Defines output parameters in a response from the | Name | Type | Tags | Description | | --- | --- | --- | --- | | `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors encountered during the request. | -| `subscription` | [`Subscription \| undefined`](../../doc/models/subscription.md) | Optional | Represents a subscription to a subscription plan by a subscriber.

For an overview of the `Subscription` type, see
[Subscription object](https://developer.squareup.com/docs/subscriptions-api/overview#subscription-object-overview). | +| `subscription` | [`Subscription \| undefined`](../../doc/models/subscription.md) | Optional | Represents a subscription purchased by a customer.

For more information, see
[Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). | ## Example (as JSON) @@ -37,7 +37,8 @@ Defines output parameters in a response from the "status": "PENDING", "tax_percentage": "5", "timezone": "America/Los_Angeles", - "version": 1594155459464 + "version": 1594155459464, + "plan_variation_id": "plan_variation_id8" }, "errors": [ { diff --git a/doc/models/create-terminal-checkout-response.md b/doc/models/create-terminal-checkout-response.md index 63401f46..7f086a85 100644 --- a/doc/models/create-terminal-checkout-response.md +++ b/doc/models/create-terminal-checkout-response.md @@ -23,7 +23,7 @@ }, "app_id": "APP_ID", "created_at": "2020-04-06T16:39:32.545Z", - "deadline_duration": "PT10M", + "deadline_duration": "PT5M", "device_options": { "device_id": "dbb5d83a-7838-11ea-bc55-0242ac130003", "skip_receipt_screen": false, diff --git a/doc/models/data-collection-options-input-type.md b/doc/models/data-collection-options-input-type.md new file mode 100644 index 00000000..083724f8 --- /dev/null +++ b/doc/models/data-collection-options-input-type.md @@ -0,0 +1,16 @@ + +# Data Collection Options Input Type + +Describes the input type of the data. + +## Enumeration + +`DataCollectionOptionsInputType` + +## Fields + +| Name | Description | +| --- | --- | +| `EMAIL` | This value is used to represent an input text that contains a email validation on the
client. | +| `PHONE_NUMBER` | This value is used to represent an input text that contains a phone number validation on
the client. | + diff --git a/doc/models/data-collection-options.md b/doc/models/data-collection-options.md new file mode 100644 index 00000000..4f52cdc1 --- /dev/null +++ b/doc/models/data-collection-options.md @@ -0,0 +1,29 @@ + +# Data Collection Options + +## Structure + +`DataCollectionOptions` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `title` | `string` | Required | The title text to display in the data collection flow on the Terminal.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `250` | +| `body` | `string` | Required | The body text to display under the title in the data collection screen flow on the
Terminal.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `10000` | +| `inputType` | [`string`](../../doc/models/data-collection-options-input-type.md) | Required | Describes the input type of the data. | +| `collectedData` | [`CollectedData \| undefined`](../../doc/models/collected-data.md) | Optional | - | + +## Example (as JSON) + +```json +{ + "title": "title4", + "body": "body6", + "input_type": "EMAIL", + "collected_data": { + "input_text": "input_text0" + } +} +``` + diff --git a/doc/models/delete-subscription-action-response.md b/doc/models/delete-subscription-action-response.md index b044d6e6..700090ef 100644 --- a/doc/models/delete-subscription-action-response.md +++ b/doc/models/delete-subscription-action-response.md @@ -13,7 +13,7 @@ endpoint. | Name | Type | Tags | Description | | --- | --- | --- | --- | | `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors encountered during the request. | -| `subscription` | [`Subscription \| undefined`](../../doc/models/subscription.md) | Optional | Represents a subscription to a subscription plan by a subscriber.

For an overview of the `Subscription` type, see
[Subscription object](https://developer.squareup.com/docs/subscriptions-api/overview#subscription-object-overview). | +| `subscription` | [`Subscription \| undefined`](../../doc/models/subscription.md) | Optional | Represents a subscription purchased by a customer.

For more information, see
[Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). | ## Example (as JSON) @@ -40,7 +40,8 @@ endpoint. }, "start_date": "2021-10-20", "status": "ACTIVE", - "timezone": "America/Los_Angeles" + "timezone": "America/Los_Angeles", + "plan_variation_id": "plan_variation_id8" }, "errors": [ { diff --git a/doc/models/dismiss-terminal-action-response.md b/doc/models/dismiss-terminal-action-response.md new file mode 100644 index 00000000..ea1031c1 --- /dev/null +++ b/doc/models/dismiss-terminal-action-response.md @@ -0,0 +1,63 @@ + +# Dismiss Terminal Action Response + +## Structure + +`DismissTerminalActionResponse` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Information on errors encountered during the request. | +| `action` | [`TerminalAction \| undefined`](../../doc/models/terminal-action.md) | Optional | Represents an action processed by the Square Terminal. | + +## Example (as JSON) + +```json +{ + "action": { + "app_id": "APP_ID", + "await_next_action": true, + "await_next_action_duration": "PT5M", + "confirmation_options": { + "agree_button_text": "Agree", + "body": "I agree to receive promotional emails about future events and activities.", + "decision": { + "has_agreed": true + }, + "disagree_button_text": "Decline", + "title": "Marketing communications" + }, + "created_at": "2021-07-28T23:22:07.476Z", + "deadline_duration": "PT5M", + "device_id": "DEVICE_ID", + "id": "termapia:abcdefg1234567", + "status": "COMPLETED", + "type": "CONFIRMATION", + "updated_at": "2021-07-28T23:22:29.511Z", + "cancel_reason": "TIMED_OUT" + }, + "errors": [ + { + "category": "AUTHENTICATION_ERROR", + "code": "REFUND_ALREADY_PENDING", + "detail": "detail1", + "field": "field9" + }, + { + "category": "INVALID_REQUEST_ERROR", + "code": "PAYMENT_NOT_REFUNDABLE", + "detail": "detail2", + "field": "field0" + }, + { + "category": "RATE_LIMIT_ERROR", + "code": "REFUND_DECLINED", + "detail": "detail3", + "field": "field1" + } + ] +} +``` + diff --git a/doc/models/employee-wage.md b/doc/models/employee-wage.md index 67c0f469..591420d1 100644 --- a/doc/models/employee-wage.md +++ b/doc/models/employee-wage.md @@ -1,8 +1,7 @@ # Employee Wage -The hourly wage rate that an employee earns on a `Shift` for doing the job -specified by the `title` property of this object. Deprecated at version 2020-08-26. Use `TeamMemberWage` instead. +The hourly wage rate that an employee earns on a `Shift` for doing the job specified by the `title` property of this object. Deprecated at version 2020-08-26. Use [TeamMemberWage](entity:TeamMemberWage). ## Structure diff --git a/doc/models/get-employee-wage-response.md b/doc/models/get-employee-wage-response.md index 1b5f0831..c91d6977 100644 --- a/doc/models/get-employee-wage-response.md +++ b/doc/models/get-employee-wage-response.md @@ -13,7 +13,7 @@ the request resulted in errors. | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `employeeWage` | [`EmployeeWage \| undefined`](../../doc/models/employee-wage.md) | Optional | The hourly wage rate that an employee earns on a `Shift` for doing the job
specified by the `title` property of this object. Deprecated at version 2020-08-26. Use `TeamMemberWage` instead. | +| `employeeWage` | [`EmployeeWage \| undefined`](../../doc/models/employee-wage.md) | Optional | The hourly wage rate that an employee earns on a `Shift` for doing the job specified by the `title` property of this object. Deprecated at version 2020-08-26. Use [TeamMemberWage](entity:TeamMemberWage). | | `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | ## Example (as JSON) diff --git a/doc/models/get-team-member-wage-response.md b/doc/models/get-team-member-wage-response.md index aeaba124..917edaeb 100644 --- a/doc/models/get-team-member-wage-response.md +++ b/doc/models/get-team-member-wage-response.md @@ -27,7 +27,8 @@ the request resulted in errors. }, "id": "pXS3qCv7BERPnEGedM4S8mhm", "team_member_id": "33fJchumvVdJwxV0H6L9", - "title": "Manager" + "title": "Manager", + "job_id": "job_id4" }, "errors": [ { diff --git a/doc/models/get-terminal-checkout-response.md b/doc/models/get-terminal-checkout-response.md index 0f234740..ee7b7467 100644 --- a/doc/models/get-terminal-checkout-response.md +++ b/doc/models/get-terminal-checkout-response.md @@ -23,7 +23,7 @@ }, "app_id": "APP_ID", "created_at": "2020-04-06T16:39:32.545Z", - "deadline_duration": "PT10M", + "deadline_duration": "PT5M", "device_options": { "device_id": "dbb5d83a-7838-11ea-bc55-0242ac130003", "skip_receipt_screen": false, diff --git a/doc/models/list-payouts-response.md b/doc/models/list-payouts-response.md index c735faf2..07be65a8 100644 --- a/doc/models/list-payouts-response.md +++ b/doc/models/list-payouts-response.md @@ -33,6 +33,7 @@ The response to retrieve payout records entries. "id": "ccof:ZPp3oedR3AeEUNd3z7", "type": "CARD" }, + "end_to_end_id": "L2100000005", "id": "po_b345d2c7-90b3-4f0b-a2aa-df1def7f8afc", "location_id": "L88917AVBK2S5", "payout_fee": [ @@ -62,6 +63,7 @@ The response to retrieve payout records entries. "id": "bact:ZPp3oedR3AeEUNd3z7", "type": "BANK_ACCOUNT" }, + "end_to_end_id": "L2100000006", "id": "po_f3c0fb38-a5ce-427d-b858-52b925b72e45", "location_id": "L88917AVBK2S5", "status": "PAID", diff --git a/doc/models/list-subscription-events-request.md b/doc/models/list-subscription-events-request.md index c627ee4f..c1d1fc08 100644 --- a/doc/models/list-subscription-events-request.md +++ b/doc/models/list-subscription-events-request.md @@ -13,7 +13,7 @@ endpoint. | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `cursor` | `string \| undefined` | Optional | When the total number of resulting subscription events exceeds the limit of a paged response,
specify the cursor returned from a preceding response here to fetch the next set of results.
If the cursor is unset, the response contains the last page of the results.

For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). | +| `cursor` | `string \| undefined` | Optional | When the total number of resulting subscription events exceeds the limit of a paged response,
specify the cursor returned from a preceding response here to fetch the next set of results.
If the cursor is unset, the response contains the last page of the results.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | | `limit` | `number \| undefined` | Optional | The upper limit on the number of subscription events to return
in a paged response.
**Constraints**: `>= 1` | ## Example (as JSON) diff --git a/doc/models/list-subscription-events-response.md b/doc/models/list-subscription-events-response.md index 16a99ff0..623d4ac2 100644 --- a/doc/models/list-subscription-events-response.md +++ b/doc/models/list-subscription-events-response.md @@ -14,74 +14,12 @@ Defines output parameters in a response from the | --- | --- | --- | --- | | `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors encountered during the request. | | `subscriptionEvents` | [`SubscriptionEvent[] \| undefined`](../../doc/models/subscription-event.md) | Optional | The retrieved subscription events. | -| `cursor` | `string \| undefined` | Optional | When the total number of resulting subscription events exceeds the limit of a paged response,
the response includes a cursor for you to use in a subsequent request to fetch the next set of events.
If the cursor is unset, the response contains the last page of the results.

For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). | +| `cursor` | `string \| undefined` | Optional | When the total number of resulting subscription events exceeds the limit of a paged response,
the response includes a cursor for you to use in a subsequent request to fetch the next set of events.
If the cursor is unset, the response contains the last page of the results.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | ## Example (as JSON) ```json { - "subscription_events": [ - { - "effective_date": "2020-04-24", - "id": "06809161-3867-4598-8269-8aea5be4f9de", - "plan_id": "6JHXF3B2CW3YKHDV4XEM674H", - "subscription_event_type": "START_SUBSCRIPTION", - "info": { - "detail": "detail2", - "code": "CUSTOMER_NO_NAME" - } - }, - { - "effective_date": "2020-05-01", - "id": "f2736603-cd2e-47ec-8675-f815fff54f88", - "info": { - "code": "CUSTOMER_NO_NAME", - "detail": "The customer with ID `V74BMG0GPS2KNCWJE1BTYJ37Y0` does not have a name on record." - }, - "plan_id": "6JHXF3B2CW3YKHDV4XEM674H", - "subscription_event_type": "DEACTIVATE_SUBSCRIPTION" - }, - { - "effective_date": "2022-05-01", - "id": "b426fc85-6859-450b-b0d0-fe3a5d1b565f", - "plan_id": "6JHXF3B2CW3YKHDV4XEM674H", - "subscription_event_type": "RESUME_SUBSCRIPTION", - "info": { - "detail": "detail4", - "code": "LOCATION_NOT_ACTIVE" - } - }, - { - "effective_date": "2022-05-02", - "id": "09f14de1-2f53-4dae-9091-49aa53f83d01", - "plan_id": "6JHXF3B2CW3YKHDV4XEM674H", - "subscription_event_type": "PAUSE_SUBSCRIPTION", - "info": { - "detail": "detail5", - "code": "LOCATION_CANNOT_ACCEPT_PAYMENT" - } - }, - { - "effective_date": "2020-05-02", - "id": "f28a73ac-1a1b-4b0f-8eeb-709a72945776", - "plan_id": "6JHXF3B2CW3YKHDV4XEM674H", - "subscription_event_type": "RESUME_SUBSCRIPTION", - "info": { - "detail": "detail6", - "code": "CUSTOMER_DELETED" - } - }, - { - "effective_date": "2020-05-06", - "id": "a0c08083-5db0-4800-85c7-d398de4fbb6e", - "plan_id": "6JHXF3B2CW3YKHDV4XEM674H", - "subscription_event_type": "STOP_SUBSCRIPTION", - "info": { - "detail": "detail7", - "code": "CUSTOMER_NO_EMAIL" - } - } - ], "errors": [ { "category": "AUTHENTICATION_ERROR", @@ -102,6 +40,62 @@ Defines output parameters in a response from the "field": "field1" } ], + "subscription_events": [ + { + "id": "id6", + "subscription_event_type": "STOP_SUBSCRIPTION", + "effective_date": "effective_date4", + "info": { + "detail": "detail2", + "code": "CUSTOMER_NO_NAME" + }, + "phases": [ + { + "uid": "uid1", + "ordinal": 17, + "order_template_id": "order_template_id3", + "plan_phase_uid": "plan_phase_uid7" + }, + { + "uid": "uid0", + "ordinal": 16, + "order_template_id": "order_template_id2", + "plan_phase_uid": "plan_phase_uid6" + }, + { + "uid": "uid9", + "ordinal": 15, + "order_template_id": "order_template_id1", + "plan_phase_uid": "plan_phase_uid5" + } + ], + "plan_variation_id": "plan_variation_id0" + }, + { + "id": "id7", + "subscription_event_type": "PLAN_CHANGE", + "effective_date": "effective_date3", + "info": { + "detail": "detail3", + "code": "USER_PROVIDED" + }, + "phases": [ + { + "uid": "uid2", + "ordinal": 18, + "order_template_id": "order_template_id4", + "plan_phase_uid": "plan_phase_uid8" + }, + { + "uid": "uid1", + "ordinal": 17, + "order_template_id": "order_template_id3", + "plan_phase_uid": "plan_phase_uid7" + } + ], + "plan_variation_id": "plan_variation_id1" + } + ], "cursor": "cursor6" } ``` diff --git a/doc/models/list-team-member-wages-response.md b/doc/models/list-team-member-wages-response.md index c566b4a4..409cca4f 100644 --- a/doc/models/list-team-member-wages-response.md +++ b/doc/models/list-team-member-wages-response.md @@ -29,7 +29,8 @@ a set of `TeamMemberWage` objects. }, "id": "pXS3qCv7BERPnEGedM4S8mhm", "team_member_id": "33fJchumvVdJwxV0H6L9", - "title": "Manager" + "title": "Manager", + "job_id": "job_id9" }, { "hourly_rate": { @@ -38,7 +39,8 @@ a set of `TeamMemberWage` objects. }, "id": "rZduCkzYDUVL3ovh1sQgbue6", "team_member_id": "33fJchumvVdJwxV0H6L9", - "title": "Cook" + "title": "Cook", + "job_id": "job_id8" }, { "hourly_rate": { @@ -47,7 +49,8 @@ a set of `TeamMemberWage` objects. }, "id": "FxLbs5KpPUHa8wyt5ctjubDX", "team_member_id": "33fJchumvVdJwxV0H6L9", - "title": "Barista" + "title": "Barista", + "job_id": "job_id7" }, { "hourly_rate": { @@ -56,7 +59,8 @@ a set of `TeamMemberWage` objects. }, "id": "vD1wCgijMDR3cX5TPnu7VXto", "team_member_id": "33fJchumvVdJwxV0H6L9", - "title": "Cashier" + "title": "Cashier", + "job_id": "job_id6" } ], "errors": [ diff --git a/doc/models/obtain-token-request.md b/doc/models/obtain-token-request.md index a9129943..3f6d2b24 100644 --- a/doc/models/obtain-token-request.md +++ b/doc/models/obtain-token-request.md @@ -9,16 +9,16 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `clientId` | `string` | Required | The Square-issued ID of your application, which is available in the OAuth page in the
[Developer Dashboard](https://developer.squareup.com/apps).
**Constraints**: *Maximum Length*: `191` | -| `clientSecret` | `string \| undefined` | Optional | The Square-issued application secret for your application, which is available in the OAuth page
in the [Developer Dashboard](https://developer.squareup.com/apps). This parameter is only required when you are not using the [OAuth PKCE (Proof Key for Code Exchange) flow](https://developer.squareup.com/docs/oauth-api/overview#pkce-flow).
The PKCE flow requires a `code_verifier` instead of a `client_secret`.
**Constraints**: *Minimum Length*: `2`, *Maximum Length*: `1024` | +| `clientId` | `string` | Required | The Square-issued ID of your application, which is available on the **OAuth** page in the
[Developer Dashboard](https://developer.squareup.com/apps).
**Constraints**: *Maximum Length*: `191` | +| `clientSecret` | `string \| undefined` | Optional | The Square-issued application secret for your application, which is available on the **OAuth** page
in the [Developer Dashboard](https://developer.squareup.com/apps). This parameter is only required when
you're not using the [OAuth PKCE (Proof Key for Code Exchange) flow](https://developer.squareup.com/docs/oauth-api/overview#pkce-flow).
The PKCE flow requires a `code_verifier` instead of a `client_secret` when `grant_type` is set to `authorization_code`.
If `grant_type` is set to `refresh_token` and the `refresh_token` is obtained uaing PKCE, the PKCE flow only requires `client_id`, 
`grant_type`, and `refresh_token`.
**Constraints**: *Minimum Length*: `2`, *Maximum Length*: `1024` | | `code` | `string \| undefined` | Optional | The authorization code to exchange.
This code is required if `grant_type` is set to `authorization_code` to indicate that
the application wants to exchange an authorization code for an OAuth access token.
**Constraints**: *Maximum Length*: `191` | -| `redirectUri` | `string \| undefined` | Optional | The redirect URL assigned in the OAuth page for your application in the [Developer Dashboard](https://developer.squareup.com/apps).
**Constraints**: *Maximum Length*: `2048` | +| `redirectUri` | `string \| undefined` | Optional | The redirect URL assigned on the **OAuth** page for your application in the [Developer Dashboard](https://developer.squareup.com/apps).
**Constraints**: *Maximum Length*: `2048` | | `grantType` | `string` | Required | Specifies the method to request an OAuth access token.
Valid values are `authorization_code`, `refresh_token`, and `migration_token`.
**Constraints**: *Minimum Length*: `10`, *Maximum Length*: `20` | | `refreshToken` | `string \| undefined` | Optional | A valid refresh token for generating a new OAuth access token.

A valid refresh token is required if `grant_type` is set to `refresh_token`
to indicate that the application wants a replacement for an expired OAuth access token.
**Constraints**: *Minimum Length*: `2`, *Maximum Length*: `1024` | | `migrationToken` | `string \| undefined` | Optional | A legacy OAuth access token obtained using a Connect API version prior
to 2019-03-13. This parameter is required if `grant_type` is set to
`migration_token` to indicate that the application wants to get a replacement
OAuth access token. The response also returns a refresh token.
For more information, see [Migrate to Using Refresh Tokens](https://developer.squareup.com/docs/oauth-api/migrate-to-refresh-tokens).
**Constraints**: *Minimum Length*: `2`, *Maximum Length*: `1024` | | `scopes` | `string[] \| undefined` | Optional | A JSON list of strings representing the permissions that the application is requesting.
For example, "`["MERCHANT_PROFILE_READ","PAYMENTS_READ","BANK_ACCOUNTS_READ"]`".

The access token returned in the response is granted the permissions
that comprise the intersection between the requested list of permissions and those
that belong to the provided refresh token. | | `shortLived` | `boolean \| undefined` | Optional | A Boolean indicating a request for a short-lived access token.

The short-lived access token returned in the response expires in 24 hours. | -| `codeVerifier` | `string \| undefined` | Optional | Must be provided when using PKCE OAuth flow. The `code_verifier` will be used to verify against the
`code_challenge` associated with the `authorization_code`. | +| `codeVerifier` | `string \| undefined` | Optional | Must be provided when using the PKCE OAuth flow if `grant_type` is set to `authorization_code`. The `code_verifier` is used to verify against the
`code_challenge` associated with the `authorization_code`. | ## Example (as JSON) diff --git a/doc/models/pause-subscription-response.md b/doc/models/pause-subscription-response.md index 60211306..1d8e5688 100644 --- a/doc/models/pause-subscription-response.md +++ b/doc/models/pause-subscription-response.md @@ -13,7 +13,7 @@ Defines output parameters in a response from the | Name | Type | Tags | Description | | --- | --- | --- | --- | | `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors encountered during the request. | -| `subscription` | [`Subscription \| undefined`](../../doc/models/subscription.md) | Optional | Represents a subscription to a subscription plan by a subscriber.

For an overview of the `Subscription` type, see
[Subscription object](https://developer.squareup.com/docs/subscriptions-api/overview#subscription-object-overview). | +| `subscription` | [`Subscription \| undefined`](../../doc/models/subscription.md) | Optional | Represents a subscription purchased by a customer.

For more information, see
[Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). | | `actions` | [`SubscriptionAction[] \| undefined`](../../doc/models/subscription-action.md) | Optional | The list of a `PAUSE` action and a possible `RESUME` action created by the request. | ## Example (as JSON) @@ -25,7 +25,15 @@ Defines output parameters in a response from the "effective_date": "2021-11-17", "id": "99b2439e-63f7-3ad5-95f7-ab2447a80673", "type": "PAUSE", - "new_plan_id": "new_plan_id5" + "phases": [ + { + "uid": "uid6", + "ordinal": 186, + "order_template_id": "order_template_id8", + "plan_phase_uid": "plan_phase_uid2" + } + ], + "new_plan_variation_id": "new_plan_variation_id9" } ], "subscription": { @@ -44,6 +52,7 @@ Defines output parameters in a response from the "status": "ACTIVE", "timezone": "America/Los_Angeles", "version": 1594311617331, + "plan_variation_id": "plan_variation_id8", "start_date": "start_date8" }, "errors": [ diff --git a/doc/models/payment-link-related-resources.md b/doc/models/payment-link-related-resources.md index 25454a91..40b44ac6 100644 --- a/doc/models/payment-link-related-resources.md +++ b/doc/models/payment-link-related-resources.md @@ -130,7 +130,7 @@ ], "subscription_plans": [ { - "type": "QUICK_AMOUNTS_SETTINGS", + "type": "ITEM_OPTION_VAL", "id": "id6", "updated_at": "updated_at2", "version": 126, @@ -156,7 +156,7 @@ ] }, { - "type": "CUSTOM_ATTRIBUTE_DEFINITION", + "type": "ITEM_OPTION", "id": "id7", "updated_at": "updated_at3", "version": 127, diff --git a/doc/models/payout.md b/doc/models/payout.md index 4d25f879..a670e4fb 100644 --- a/doc/models/payout.md +++ b/doc/models/payout.md @@ -23,6 +23,7 @@ external bank account or to the Square balance. | `type` | [`string \| undefined`](../../doc/models/payout-type.md) | Optional | The type of payout: “BATCH” or “SIMPLE”.
BATCH payouts include a list of payout entries that can be considered settled.
SIMPLE payouts do not have any payout entries associated with them
and will show up as one of the payout entries in a future BATCH payout. | | `payoutFee` | [`PayoutFee[] \| undefined`](../../doc/models/payout-fee.md) | Optional | A list of transfer fees and any taxes on the fees assessed by Square for this payout. | | `arrivalDate` | `string \| undefined` | Optional | The calendar date, in ISO 8601 format (YYYY-MM-DD), when the payout is due to arrive in the seller’s banking destination. | +| `endToEndId` | `string \| undefined` | Optional | A unique ID for each `Payout` object that might also appear on the seller’s bank statement. You can use this ID to automate the process of reconciling each payout with the corresponding line item on the bank statement. | ## Example (as JSON) diff --git a/doc/models/phase-input.md b/doc/models/phase-input.md new file mode 100644 index 00000000..ca7e6ada --- /dev/null +++ b/doc/models/phase-input.md @@ -0,0 +1,25 @@ + +# Phase Input + +Represents the arguments used to construct a new phase. + +## Structure + +`PhaseInput` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `ordinal` | `number` | Required | index of phase in total subscription plan | +| `orderTemplateId` | `string \| undefined` | Optional | id of order to be used in billing | + +## Example (as JSON) + +```json +{ + "ordinal": 80, + "order_template_id": "order_template_id2" +} +``` + diff --git a/doc/models/phase.md b/doc/models/phase.md new file mode 100644 index 00000000..7f5dcf60 --- /dev/null +++ b/doc/models/phase.md @@ -0,0 +1,29 @@ + +# Phase + +Represents a phase, which can override subscription phases as defined by plan_id + +## Structure + +`Phase` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `uid` | `string \| undefined` | Optional | id of subscription phase | +| `ordinal` | `number \| undefined` | Optional | index of phase in total subscription plan | +| `orderTemplateId` | `string \| undefined` | Optional | id of order to be used in billing | +| `planPhaseUid` | `string \| undefined` | Optional | the uid from the plan's phase in catalog | + +## Example (as JSON) + +```json +{ + "uid": "uid0", + "ordinal": 80, + "order_template_id": "order_template_id2", + "plan_phase_uid": "plan_phase_uid6" +} +``` + diff --git a/doc/models/qr-code-options.md b/doc/models/qr-code-options.md new file mode 100644 index 00000000..d463b74f --- /dev/null +++ b/doc/models/qr-code-options.md @@ -0,0 +1,27 @@ + +# Qr Code Options + +Fields to describe the action that displays QR-Codes. + +## Structure + +`QrCodeOptions` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `title` | `string` | Required | The title text to display in the QR code flow on the Terminal.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `250` | +| `body` | `string` | Required | The body text to display in the QR code flow on the Terminal.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `10000` | +| `barcodeContents` | `string` | Required | The text representation of the data to show in the QR code
as UTF8-encoded data.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `1024` | + +## Example (as JSON) + +```json +{ + "title": "title4", + "body": "body6", + "barcode_contents": "barcode_contents8" +} +``` + diff --git a/doc/models/resume-subscription-response.md b/doc/models/resume-subscription-response.md index 4b069e61..33ee8587 100644 --- a/doc/models/resume-subscription-response.md +++ b/doc/models/resume-subscription-response.md @@ -13,7 +13,7 @@ Defines output parameters in a response from the | Name | Type | Tags | Description | | --- | --- | --- | --- | | `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors encountered during the request. | -| `subscription` | [`Subscription \| undefined`](../../doc/models/subscription.md) | Optional | Represents a subscription to a subscription plan by a subscriber.

For an overview of the `Subscription` type, see
[Subscription object](https://developer.squareup.com/docs/subscriptions-api/overview#subscription-object-overview). | +| `subscription` | [`Subscription \| undefined`](../../doc/models/subscription.md) | Optional | Represents a subscription purchased by a customer.

For more information, see
[Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). | | `actions` | [`SubscriptionAction[] \| undefined`](../../doc/models/subscription-action.md) | Optional | A list of `RESUME` actions created by the request and scheduled for the subscription. | ## Example (as JSON) @@ -25,7 +25,15 @@ Defines output parameters in a response from the "effective_date": "2022-01-01", "id": "18ff74f4-3da4-30c5-929f-7d6fca84f115", "type": "RESUME", - "new_plan_id": "new_plan_id5" + "phases": [ + { + "uid": "uid6", + "ordinal": 186, + "order_template_id": "order_template_id8", + "plan_phase_uid": "plan_phase_uid2" + } + ], + "new_plan_variation_id": "new_plan_variation_id9" } ], "subscription": { @@ -44,6 +52,7 @@ Defines output parameters in a response from the "status": "ACTIVE", "timezone": "America/Los_Angeles", "version": 1594311617331, + "plan_variation_id": "plan_variation_id8", "start_date": "start_date8" }, "errors": [ diff --git a/doc/models/retrieve-subscription-response.md b/doc/models/retrieve-subscription-response.md index 640f01da..97d5bea3 100644 --- a/doc/models/retrieve-subscription-response.md +++ b/doc/models/retrieve-subscription-response.md @@ -13,7 +13,7 @@ Defines output parameters in a response from the | Name | Type | Tags | Description | | --- | --- | --- | --- | | `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors encountered during the request. | -| `subscription` | [`Subscription \| undefined`](../../doc/models/subscription.md) | Optional | Represents a subscription to a subscription plan by a subscriber.

For an overview of the `Subscription` type, see
[Subscription object](https://developer.squareup.com/docs/subscriptions-api/overview#subscription-object-overview). | +| `subscription` | [`Subscription \| undefined`](../../doc/models/subscription.md) | Optional | Represents a subscription purchased by a customer.

For more information, see
[Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). | ## Example (as JSON) @@ -40,7 +40,8 @@ Defines output parameters in a response from the }, "start_date": "2021-10-20", "status": "ACTIVE", - "timezone": "America/Los_Angeles" + "timezone": "America/Los_Angeles", + "plan_variation_id": "plan_variation_id8" }, "errors": [ { diff --git a/doc/models/retrieve-token-status-response.md b/doc/models/retrieve-token-status-response.md index 2464ddc4..3ff39535 100644 --- a/doc/models/retrieve-token-status-response.md +++ b/doc/models/retrieve-token-status-response.md @@ -2,7 +2,7 @@ # Retrieve Token Status Response Defines the fields that are included in the response body of -a request to the `RetrieveTokenStatus` endpoint +a request to the `RetrieveTokenStatus` endpoint. ## Structure @@ -13,7 +13,7 @@ a request to the `RetrieveTokenStatus` endpoint | Name | Type | Tags | Description | | --- | --- | --- | --- | | `scopes` | `string[] \| undefined` | Optional | The list of scopes associated with an access token. | -| `expiresAt` | `string \| undefined` | Optional | The date and time when the `access_token` expires, in RFC 3339 format. Empty if token never expires. | +| `expiresAt` | `string \| undefined` | Optional | The date and time when the `access_token` expires, in RFC 3339 format. Empty if the token never expires. | | `clientId` | `string \| undefined` | Optional | The Square-issued application ID associated with the access token. This is the same application ID used to obtain the token.
**Constraints**: *Maximum Length*: `191` | | `merchantId` | `string \| undefined` | Optional | The ID of the authorizing merchant's business.
**Constraints**: *Minimum Length*: `8`, *Maximum Length*: `191` | | `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Any errors that occurred during the request. | diff --git a/doc/models/revoke-token-request.md b/doc/models/revoke-token-request.md index e135d557..165d8f78 100644 --- a/doc/models/revoke-token-request.md +++ b/doc/models/revoke-token-request.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `clientId` | `string \| undefined` | Optional | The Square-issued ID for your application, which is available in the OAuth page in the
[Developer Dashboard](https://developer.squareup.com/apps).
**Constraints**: *Maximum Length*: `191` | +| `clientId` | `string \| undefined` | Optional | The Square-issued ID for your application, which is available on the **OAuth** page in the
[Developer Dashboard](https://developer.squareup.com/apps).
**Constraints**: *Maximum Length*: `191` | | `accessToken` | `string \| undefined` | Optional | The access token of the merchant whose token you want to revoke.
Do not provide a value for `merchant_id` if you provide this parameter.
**Constraints**: *Minimum Length*: `2`, *Maximum Length*: `1024` | | `merchantId` | `string \| undefined` | Optional | The ID of the merchant whose token you want to revoke.
Do not provide a value for `access_token` if you provide this parameter. | | `revokeOnlyAccessToken` | `boolean \| undefined` | Optional | If `true`, terminate the given single access token, but do not
terminate the entire authorization.
Default: `false` | diff --git a/doc/models/search-catalog-items-response.md b/doc/models/search-catalog-items-response.md index 9ae52aab..f88f831a 100644 --- a/doc/models/search-catalog-items-response.md +++ b/doc/models/search-catalog-items-response.md @@ -42,7 +42,7 @@ Defines the response body returned from the [SearchCatalogItems](../../doc/api/c ], "items": [ { - "type": "PRODUCT_SET", + "type": "DISCOUNT", "id": "id7", "updated_at": "updated_at7", "version": 143, @@ -68,7 +68,7 @@ Defines the response body returned from the [SearchCatalogItems](../../doc/api/c ] }, { - "type": "PRICING_RULE", + "type": "TAX", "id": "id8", "updated_at": "updated_at6", "version": 144, diff --git a/doc/models/search-catalog-objects-response.md b/doc/models/search-catalog-objects-response.md index 75afe960..bc30d67e 100644 --- a/doc/models/search-catalog-objects-response.md +++ b/doc/models/search-catalog-objects-response.md @@ -179,7 +179,7 @@ "cursor": "cursor6", "related_objects": [ { - "type": "CATEGORY", + "type": "PRICING_RULE", "id": "id8", "updated_at": "updated_at6", "version": 170, @@ -205,7 +205,7 @@ ] }, { - "type": "IMAGE", + "type": "MODIFIER", "id": "id9", "updated_at": "updated_at5", "version": 169, @@ -249,7 +249,7 @@ ] }, { - "type": "ITEM", + "type": "MODIFIER_LIST", "id": "id0", "updated_at": "updated_at4", "version": 168, diff --git a/doc/models/search-subscriptions-request.md b/doc/models/search-subscriptions-request.md index 9f538d02..64400f43 100644 --- a/doc/models/search-subscriptions-request.md +++ b/doc/models/search-subscriptions-request.md @@ -12,7 +12,7 @@ Defines input parameters in a request to the | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `cursor` | `string \| undefined` | Optional | When the total number of resulting subscriptions exceeds the limit of a paged response,
specify the cursor returned from a preceding response here to fetch the next set of results.
If the cursor is unset, the response contains the last page of the results.

For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). | +| `cursor` | `string \| undefined` | Optional | When the total number of resulting subscriptions exceeds the limit of a paged response,
specify the cursor returned from a preceding response here to fetch the next set of results.
If the cursor is unset, the response contains the last page of the results.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | | `limit` | `number \| undefined` | Optional | The upper limit on the number of subscriptions to return
in a paged response.
**Constraints**: `>= 1` | | `query` | [`SearchSubscriptionsQuery \| undefined`](../../doc/models/search-subscriptions-query.md) | Optional | Represents a query, consisting of specified query expressions, used to search for subscriptions. | | `include` | `string[] \| undefined` | Optional | An option to include related information in the response.

The supported values are:

- `actions`: to include scheduled actions on the targeted subscriptions. | diff --git a/doc/models/search-subscriptions-response.md b/doc/models/search-subscriptions-response.md index c987fa75..b5781abc 100644 --- a/doc/models/search-subscriptions-response.md +++ b/doc/models/search-subscriptions-response.md @@ -14,7 +14,7 @@ Defines output parameters in a response from the | --- | --- | --- | --- | | `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors encountered during the request. | | `subscriptions` | [`Subscription[] \| undefined`](../../doc/models/subscription.md) | Optional | The subscriptions matching the specified query expressions. | -| `cursor` | `string \| undefined` | Optional | When the total number of resulting subscription exceeds the limit of a paged response,
the response includes a cursor for you to use in a subsequent request to fetch the next set of results.
If the cursor is unset, the response contains the last page of the results.

For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). | +| `cursor` | `string \| undefined` | Optional | When the total number of resulting subscription exceeds the limit of a paged response,
the response includes a cursor for you to use in a subsequent request to fetch the next set of results.
If the cursor is unset, the response contains the last page of the results.

For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). | ## Example (as JSON) @@ -36,7 +36,8 @@ Defines output parameters in a response from the }, "start_date": "2021-10-20", "status": "CANCELED", - "timezone": "UTC" + "timezone": "UTC", + "plan_variation_id": "plan_variation_id3" }, { "created_at": "2021-10-20T21:53:10Z", @@ -55,7 +56,8 @@ Defines output parameters in a response from the "status": "PENDING", "tax_percentage": "5", "timezone": "America/Los_Angeles", - "version": 1594155459464 + "version": 1594155459464, + "plan_variation_id": "plan_variation_id4" }, { "charged_through_date": "2021-11-20", @@ -78,7 +80,8 @@ Defines output parameters in a response from the }, "start_date": "2021-10-20", "status": "ACTIVE", - "timezone": "America/Los_Angeles" + "timezone": "America/Los_Angeles", + "plan_variation_id": "plan_variation_id5" } ], "errors": [ diff --git a/doc/models/search-terminal-actions-request.md b/doc/models/search-terminal-actions-request.md index 4e8b3058..7602a4e5 100644 --- a/doc/models/search-terminal-actions-request.md +++ b/doc/models/search-terminal-actions-request.md @@ -26,7 +26,7 @@ }, "device_id": "device_id0", "status": "status4", - "type": "SAVE_CARD" + "type": "QR_CODE" }, "sort": { "sort_order": "DESC" diff --git a/doc/models/search-terminal-checkouts-response.md b/doc/models/search-terminal-checkouts-response.md index 0221a926..e0e4c988 100644 --- a/doc/models/search-terminal-checkouts-response.md +++ b/doc/models/search-terminal-checkouts-response.md @@ -25,7 +25,7 @@ }, "app_id": "APP_ID", "created_at": "2020-03-31T18:13:15.921Z", - "deadline_duration": "PT10M", + "deadline_duration": "PT5M", "device_options": { "device_id": "dbb5d83a-7838-11ea-bc55-0242ac130003", "skip_receipt_screen": false, @@ -66,7 +66,7 @@ }, "app_id": "APP_ID", "created_at": "2020-03-31T18:08:31.882Z", - "deadline_duration": "PT10M", + "deadline_duration": "PT5M", "device_options": { "device_id": "dbb5d83a-7838-11ea-bc55-0242ac130003", "skip_receipt_screen": true, diff --git a/doc/models/select-option.md b/doc/models/select-option.md new file mode 100644 index 00000000..fd4b6164 --- /dev/null +++ b/doc/models/select-option.md @@ -0,0 +1,23 @@ + +# Select Option + +## Structure + +`SelectOption` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `referenceId` | `string` | Required | The reference id for the option.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `40` | +| `title` | `string` | Required | The title text that displays in the select option button.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `250` | + +## Example (as JSON) + +```json +{ + "reference_id": "reference_id2", + "title": "title4" +} +``` + diff --git a/doc/models/select-options.md b/doc/models/select-options.md new file mode 100644 index 00000000..9c6a378f --- /dev/null +++ b/doc/models/select-options.md @@ -0,0 +1,35 @@ + +# Select Options + +## Structure + +`SelectOptions` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `title` | `string` | Required | The title text to display in the select flow on the Terminal.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `250` | +| `body` | `string` | Required | The body text to display in the select flow on the Terminal.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `10000` | +| `options` | [`SelectOption[]`](../../doc/models/select-option.md) | Required | Represents the buttons/options that should be displayed in the select flow on the Terminal. | +| `selectedOption` | [`SelectOption \| undefined`](../../doc/models/select-option.md) | Optional | - | + +## Example (as JSON) + +```json +{ + "title": "title4", + "body": "body6", + "options": [ + { + "reference_id": "reference_id1", + "title": "title3" + } + ], + "selected_option": { + "reference_id": "reference_id6", + "title": "title8" + } +} +``` + diff --git a/doc/models/shift-wage.md b/doc/models/shift-wage.md index 6b623aa9..237684fd 100644 --- a/doc/models/shift-wage.md +++ b/doc/models/shift-wage.md @@ -11,8 +11,9 @@ The hourly wage rate used to compensate an employee for this shift. | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `title` | `string \| undefined` | Optional | The name of the job performed during this shift. Square
labor-reporting UIs might group shifts together by title. | +| `title` | `string \| undefined` | Optional | The name of the job performed during this shift. | | `hourlyRate` | [`Money \| undefined`](../../doc/models/money.md) | Optional | Represents an amount of money. `Money` fields can be signed or unsigned.
Fields that do not explicitly define whether they are signed or unsigned are
considered unsigned and can only hold positive amounts. For signed fields, the
sign of the value indicates the purpose of the money transfer. See
[Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)
for more information. | +| `jobId` | `string \| undefined` | Optional | The id of the job performed during this shift. Square
labor-reporting UIs might group shifts together by id. This cannot be used to retrieve the job. | ## Example (as JSON) @@ -22,7 +23,8 @@ The hourly wage rate used to compensate an employee for this shift. "hourly_rate": { "amount": 172, "currency": "TJS" - } + }, + "job_id": "job_id2" } ``` diff --git a/doc/models/signature-image.md b/doc/models/signature-image.md new file mode 100644 index 00000000..8f69c019 --- /dev/null +++ b/doc/models/signature-image.md @@ -0,0 +1,23 @@ + +# Signature Image + +## Structure + +`SignatureImage` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `imageType` | `string \| undefined` | Optional | The mime/type of the image data.
Use `image/png;base64` for png. | +| `data` | `string \| undefined` | Optional | The base64 representation of the image. | + +## Example (as JSON) + +```json +{ + "image_type": "image_type6", + "data": "data0" +} +``` + diff --git a/doc/models/signature-options.md b/doc/models/signature-options.md new file mode 100644 index 00000000..b387123b --- /dev/null +++ b/doc/models/signature-options.md @@ -0,0 +1,30 @@ + +# Signature Options + +## Structure + +`SignatureOptions` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `title` | `string` | Required | The title text to display in the signature capture flow on the Terminal.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `250` | +| `body` | `string` | Required | The body text to display in the signature capture flow on the Terminal.
**Constraints**: *Minimum Length*: `1`, *Maximum Length*: `10000` | +| `signature` | [`SignatureImage[] \| undefined`](../../doc/models/signature-image.md) | Optional | An image representation of the collected signature. | + +## Example (as JSON) + +```json +{ + "title": "title4", + "body": "body6", + "signature": [ + { + "image_type": "image_type8", + "data": "data2" + } + ] +} +``` + diff --git a/doc/models/subscription-action.md b/doc/models/subscription-action.md index 8b792db4..9747f835 100644 --- a/doc/models/subscription-action.md +++ b/doc/models/subscription-action.md @@ -14,7 +14,8 @@ Represents an action as a pending change to a subscription. | `id` | `string \| undefined` | Optional | The ID of an action scoped to a subscription. | | `type` | [`string \| undefined`](../../doc/models/subscription-action-type.md) | Optional | Supported types of an action as a pending change to a subscription. | | `effectiveDate` | `string \| undefined` | Optional | The `YYYY-MM-DD`-formatted date when the action occurs on the subscription. | -| `newPlanId` | `string \| undefined` | Optional | The target subscription plan a subscription switches to, for a `SWAP_PLAN` action. | +| `phases` | [`Phase[] \| undefined`](../../doc/models/phase.md) | Optional | A list of Phases, to pass phase-specific information used in the swap. | +| `newPlanVariationId` | `string \| undefined` | Optional | The target subscription plan variation that a subscription switches to, for a `SWAP_PLAN` action. | ## Example (as JSON) @@ -23,7 +24,21 @@ Represents an action as a pending change to a subscription. "id": "id0", "type": "RESUME", "effective_date": "effective_date0", - "new_plan_id": "new_plan_id4" + "phases": [ + { + "uid": "uid5", + "ordinal": 207, + "order_template_id": "order_template_id7", + "plan_phase_uid": "plan_phase_uid1" + }, + { + "uid": "uid6", + "ordinal": 208, + "order_template_id": "order_template_id8", + "plan_phase_uid": "plan_phase_uid2" + } + ], + "new_plan_variation_id": "new_plan_variation_id0" } ``` diff --git a/doc/models/subscription-event.md b/doc/models/subscription-event.md index 39fa5628..8a085a7a 100644 --- a/doc/models/subscription-event.md +++ b/doc/models/subscription-event.md @@ -14,8 +14,9 @@ Describes changes to a subscription and the subscription status. | `id` | `string` | Required | The ID of the subscription event. | | `subscriptionEventType` | [`string`](../../doc/models/subscription-event-subscription-event-type.md) | Required | Supported types of an event occurred to a subscription. | | `effectiveDate` | `string` | Required | The `YYYY-MM-DD`-formatted date (for example, 2013-01-15) when the subscription event occurred. | -| `planId` | `string` | Required | The ID of the subscription plan associated with the subscription. | | `info` | [`SubscriptionEventInfo \| undefined`](../../doc/models/subscription-event-info.md) | Optional | Provides information about the subscription event. | +| `phases` | [`Phase[] \| undefined`](../../doc/models/phase.md) | Optional | A list of Phases, to pass phase-specific information used in the swap. | +| `planVariationId` | `string` | Required | The ID of the subscription plan variation associated with the subscription. | ## Example (as JSON) @@ -24,11 +25,25 @@ Describes changes to a subscription and the subscription status. "id": "id0", "subscription_event_type": "RESUME_SUBSCRIPTION", "effective_date": "effective_date0", - "plan_id": "plan_id8", "info": { "detail": "detail6", "code": "CUSTOMER_DELETED" - } + }, + "phases": [ + { + "uid": "uid5", + "ordinal": 207, + "order_template_id": "order_template_id7", + "plan_phase_uid": "plan_phase_uid1" + }, + { + "uid": "uid6", + "ordinal": 208, + "order_template_id": "order_template_id8", + "plan_phase_uid": "plan_phase_uid2" + } + ], + "plan_variation_id": "plan_variation_id4" } ``` diff --git a/doc/models/subscription-phase.md b/doc/models/subscription-phase.md index e7da7bae..ea974263 100644 --- a/doc/models/subscription-phase.md +++ b/doc/models/subscription-phase.md @@ -1,8 +1,7 @@ # Subscription Phase -Describes a phase in a subscription plan. For more information, see -[Set Up and Manage a Subscription Plan](https://developer.squareup.com/docs/subscriptions-api/setup-plan). +Describes a phase in a subscription plan variation. For more information, see [Subscription Plans and Variations](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations). ## Structure @@ -17,6 +16,7 @@ Describes a phase in a subscription plan. For more information, see | `periods` | `number \| undefined` | Optional | The number of `cadence`s the phase lasts. If not set, the phase never ends. Only the last phase can be indefinite. This field cannot be changed after a `SubscriptionPhase` is created. | | `recurringPriceMoney` | [`Money \| undefined`](../../doc/models/money.md) | Optional | Represents an amount of money. `Money` fields can be signed or unsigned.
Fields that do not explicitly define whether they are signed or unsigned are
considered unsigned and can only hold positive amounts. For signed fields, the
sign of the value indicates the purpose of the money transfer. See
[Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)
for more information. | | `ordinal` | `bigint \| undefined` | Optional | The position this phase appears in the sequence of phases defined for the plan, indexed from 0. This field cannot be changed after a `SubscriptionPhase` is created. | +| `pricing` | [`SubscriptionPricing \| undefined`](../../doc/models/subscription-pricing.md) | Optional | Describes the pricing for the subscription. | ## Example (as JSON) @@ -29,7 +29,18 @@ Describes a phase in a subscription plan. For more information, see "amount": 66, "currency": "NAD" }, - "ordinal": 80 + "ordinal": 80, + "pricing": { + "type": "STATIC", + "discount_ids": [ + "discount_ids5", + "discount_ids6" + ], + "price_money": { + "amount": 40, + "currency": "SHP" + } + } } ``` diff --git a/doc/models/subscription-pricing-type.md b/doc/models/subscription-pricing-type.md new file mode 100644 index 00000000..105aa699 --- /dev/null +++ b/doc/models/subscription-pricing-type.md @@ -0,0 +1,16 @@ + +# Subscription Pricing Type + +Determines the pricing of a [Subscription](../../doc/models/subscription.md) + +## Enumeration + +`SubscriptionPricingType` + +## Fields + +| Name | Description | +| --- | --- | +| `STATIC` | Static pricing | +| `RELATIVE` | Relative pricing | + diff --git a/doc/models/subscription-pricing.md b/doc/models/subscription-pricing.md new file mode 100644 index 00000000..97cbcc6e --- /dev/null +++ b/doc/models/subscription-pricing.md @@ -0,0 +1,33 @@ + +# Subscription Pricing + +Describes the pricing for the subscription. + +## Structure + +`SubscriptionPricing` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `type` | [`string \| undefined`](../../doc/models/subscription-pricing-type.md) | Optional | Determines the pricing of a [Subscription](../../doc/models/subscription.md) | +| `discountIds` | `string[] \| undefined` | Optional | The ids of the discount catalog objects | +| `priceMoney` | [`Money \| undefined`](../../doc/models/money.md) | Optional | Represents an amount of money. `Money` fields can be signed or unsigned.
Fields that do not explicitly define whether they are signed or unsigned are
considered unsigned and can only hold positive amounts. For signed fields, the
sign of the value indicates the purpose of the money transfer. See
[Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)
for more information. | + +## Example (as JSON) + +```json +{ + "type": "STATIC", + "discount_ids": [ + "discount_ids1", + "discount_ids2" + ], + "price_money": { + "amount": 202, + "currency": "BBD" + } +} +``` + diff --git a/doc/models/subscription.md b/doc/models/subscription.md index bee83594..b6ca6ffd 100644 --- a/doc/models/subscription.md +++ b/doc/models/subscription.md @@ -1,10 +1,10 @@ # Subscription -Represents a subscription to a subscription plan by a subscriber. +Represents a subscription purchased by a customer. -For an overview of the `Subscription` type, see -[Subscription object](https://developer.squareup.com/docs/subscriptions-api/overview#subscription-object-overview). +For more information, see +[Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). ## Structure @@ -16,7 +16,7 @@ For an overview of the `Subscription` type, see | --- | --- | --- | --- | | `id` | `string \| undefined` | Optional | The Square-assigned ID of the subscription.
**Constraints**: *Maximum Length*: `255` | | `locationId` | `string \| undefined` | Optional | The ID of the location associated with the subscription. | -| `planId` | `string \| undefined` | Optional | The ID of the subscribed-to [subscription plan](entity:CatalogSubscriptionPlan). | +| `planVariationId` | `string \| undefined` | Optional | The ID of the subscribed-to [subscription plan variation](entity:CatalogSubscriptionPlanVariation). | | `customerId` | `string \| undefined` | Optional | The ID of the subscribing [customer](entity:Customer) profile. | | `startDate` | `string \| undefined` | Optional | The `YYYY-MM-DD`-formatted date (for example, 2013-01-15) to start the subscription. | | `canceledDate` | `string \| undefined` | Optional | The `YYYY-MM-DD`-formatted date (for example, 2013-01-15) to cancel the subscription,
when the subscription status changes to `CANCELED` and the subscription billing stops.

If this field is not set, the subscription ends according its subscription plan.

This field cannot be updated, other than being cleared. | @@ -31,6 +31,7 @@ For an overview of the `Subscription` type, see | `timezone` | `string \| undefined` | Optional | Timezone that will be used in date calculations for the subscription.
Defaults to the timezone of the location based on `location_id`.
Format: the IANA Timezone Database identifier for the location timezone (for example, `America/Los_Angeles`). | | `source` | [`SubscriptionSource \| undefined`](../../doc/models/subscription-source.md) | Optional | The origination details of the subscription. | | `actions` | [`SubscriptionAction[] \| undefined`](../../doc/models/subscription-action.md) | Optional | The list of scheduled actions on this subscription. It is set only in the response from
[RetrieveSubscription](../../doc/api/subscriptions.md#retrieve-subscription) with the query parameter
of `include=actions` or from
[SearchSubscriptions](../../doc/api/subscriptions.md#search-subscriptions) with the input parameter
of `include:["actions"]`. | +| `phases` | [`Phase[] \| undefined`](../../doc/models/phase.md) | Optional | array of phases for this subscription | ## Example (as JSON) @@ -38,7 +39,7 @@ For an overview of the `Subscription` type, see { "id": "id0", "location_id": "location_id4", - "plan_id": "plan_id8", + "plan_variation_id": "plan_variation_id4", "customer_id": "customer_id8", "start_date": "start_date6" } diff --git a/doc/models/swap-plan-request.md b/doc/models/swap-plan-request.md index 79f516fe..b4a4f7bc 100644 --- a/doc/models/swap-plan-request.md +++ b/doc/models/swap-plan-request.md @@ -12,13 +12,24 @@ Defines input parameters in a call to the | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `newPlanId` | `string` | Required | The ID of the new subscription plan.
**Constraints**: *Minimum Length*: `1` | +| `newPlanVariationId` | `string \| undefined` | Optional | The ID of the new subscription plan variation.

This field is required. | +| `phases` | [`PhaseInput[] \| undefined`](../../doc/models/phase-input.md) | Optional | A list of PhaseInputs, to pass phase-specific information used in the swap. | ## Example (as JSON) ```json { - "new_plan_id": "new_plan_id4" + "new_plan_variation_id": "new_plan_variation_id0", + "phases": [ + { + "ordinal": 207, + "order_template_id": "order_template_id7" + }, + { + "ordinal": 208, + "order_template_id": "order_template_id8" + } + ] } ``` diff --git a/doc/models/swap-plan-response.md b/doc/models/swap-plan-response.md index 52c32be9..32a1f2bd 100644 --- a/doc/models/swap-plan-response.md +++ b/doc/models/swap-plan-response.md @@ -13,7 +13,7 @@ Defines output parameters in a response of the | Name | Type | Tags | Description | | --- | --- | --- | --- | | `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors encountered during the request. | -| `subscription` | [`Subscription \| undefined`](../../doc/models/subscription.md) | Optional | Represents a subscription to a subscription plan by a subscriber.

For an overview of the `Subscription` type, see
[Subscription object](https://developer.squareup.com/docs/subscriptions-api/overview#subscription-object-overview). | +| `subscription` | [`Subscription \| undefined`](../../doc/models/subscription.md) | Optional | Represents a subscription purchased by a customer.

For more information, see
[Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). | | `actions` | [`SubscriptionAction[] \| undefined`](../../doc/models/subscription-action.md) | Optional | A list of a `SWAP_PLAN` action created by the request. | ## Example (as JSON) @@ -24,8 +24,17 @@ Defines output parameters in a response of the { "effective_date": "2021-11-17", "id": "f0a1dfdc-675b-3a14-a640-99f7ac1cee83", - "new_plan_id": "DPNEOJAP33DKC3GAC5CAZG4O", - "type": "SWAP_PLAN" + "new_plan_id": "FQ7CDXXWSLUJRPM3GFJSJGZ7", + "phases": [ + { + "order_template_id": "uhhnjH9osVv3shUADwaC0b3hNxQZY", + "ordinal": 0, + "uid": "uid6", + "plan_phase_uid": "plan_phase_uid2" + } + ], + "type": "SWAP_PLAN", + "new_plan_variation_id": "new_plan_variation_id9" } ], "subscription": { @@ -33,6 +42,14 @@ Defines output parameters in a response of the "customer_id": "CHFGVKYY8RSV93M5KCYTG4PN0G", "id": "9ba40961-995a-4a3d-8c53-048c40cafc13", "location_id": "S8GWD5R9QB376", + "phases": [ + { + "order_template_id": "E6oBY5WfQ2eN4pkYZwq4ka6n7KeZY", + "ordinal": 0, + "plan_phase_uid": "C66BKH3ASTDYGJJCEZXQQSS7", + "uid": "98d6f53b-40e1-4714-8827-032fd923be25" + } + ], "plan_id": "6JHXF3B2CW3YKHDV4XEM674H", "price_override_money": { "amount": 2000, @@ -44,6 +61,7 @@ Defines output parameters in a response of the "status": "ACTIVE", "timezone": "America/Los_Angeles", "version": 1594311617331, + "plan_variation_id": "plan_variation_id8", "start_date": "start_date8" }, "errors": [ diff --git a/doc/models/team-member-wage.md b/doc/models/team-member-wage.md index a4c4d857..46dd76ca 100644 --- a/doc/models/team-member-wage.md +++ b/doc/models/team-member-wage.md @@ -16,6 +16,7 @@ specified by the `title` property of this object. | `teamMemberId` | `string \| undefined` | Optional | The `TeamMember` that this wage is assigned to. | | `title` | `string \| undefined` | Optional | The job title that this wage relates to. | | `hourlyRate` | [`Money \| undefined`](../../doc/models/money.md) | Optional | Represents an amount of money. `Money` fields can be signed or unsigned.
Fields that do not explicitly define whether they are signed or unsigned are
considered unsigned and can only hold positive amounts. For signed fields, the
sign of the value indicates the purpose of the money transfer. See
[Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts)
for more information. | +| `jobId` | `string \| undefined` | Optional | An identifier for the job that this wage relates to. This cannot be
used to retrieve the job. | ## Example (as JSON) @@ -27,7 +28,8 @@ specified by the `title` property of this object. "hourly_rate": { "amount": 172, "currency": "TJS" - } + }, + "job_id": "job_id2" } ``` diff --git a/doc/models/terminal-action-action-type.md b/doc/models/terminal-action-action-type.md index a0f00628..09d26ffd 100644 --- a/doc/models/terminal-action-action-type.md +++ b/doc/models/terminal-action-action-type.md @@ -11,7 +11,12 @@ Describes the type of this unit and indicates which field contains the unit info | Name | Description | | --- | --- | +| `QR_CODE` | The action represents a request to display a QR code. Details are contained in
the `qr_code_options` object. | | `PING` | The action represents a request to check if the specific device is
online or currently active with the merchant in question. Does not require an action options value. | | `SAVE_CARD` | Represents a request to save a card for future card-on-file use. Details are contained
in the `save_card_options` object. | +| `SIGNATURE` | The action represents a request to capture a buyer's signature. Details are contained
in the `signature_options` object. | +| `CONFIRMATION` | The action represents a request to collect a buyer's confirmation decision to the
displayed terms. Details are contained in the `confirmation_options` object. | | `RECEIPT` | The action represents a request to display the receipt screen options. Details are
contained in the `receipt_options` object. | +| `DATA_COLLECTION` | The action represents a request to collect a buyer's text data. Details
are contained in the `data_collection_options` object. | +| `SELECT` | The action represents a request to allow the buyer to select from provided options.
Details are contained in the `select_options` object. | diff --git a/doc/models/terminal-action-query-filter.md b/doc/models/terminal-action-query-filter.md index 0cf86ec5..ed44a89a 100644 --- a/doc/models/terminal-action-query-filter.md +++ b/doc/models/terminal-action-query-filter.md @@ -24,7 +24,7 @@ "end_at": "end_at8" }, "status": "status8", - "type": "RECEIPT" + "type": "DATA_COLLECTION" } ``` diff --git a/doc/models/terminal-action-query.md b/doc/models/terminal-action-query.md index 2ef6414f..e4ef1bf1 100644 --- a/doc/models/terminal-action-query.md +++ b/doc/models/terminal-action-query.md @@ -32,7 +32,7 @@ "end_at": "end_at8" }, "status": "status6", - "type": "RECEIPT" + "type": "SAVE_CARD" }, "sort": { "sort_order": "DESC" diff --git a/doc/models/terminal-action.md b/doc/models/terminal-action.md index 269efbd6..92945185 100644 --- a/doc/models/terminal-action.md +++ b/doc/models/terminal-action.md @@ -20,9 +20,16 @@ Represents an action processed by the Square Terminal. | `updatedAt` | `string \| undefined` | Optional | The time when the `TerminalAction` was last updated as an RFC 3339 timestamp. | | `appId` | `string \| undefined` | Optional | The ID of the application that created the action. | | `type` | [`string \| undefined`](../../doc/models/terminal-action-action-type.md) | Optional | Describes the type of this unit and indicates which field contains the unit information. This is an ‘open’ enum. | +| `qrCodeOptions` | [`QrCodeOptions \| undefined`](../../doc/models/qr-code-options.md) | Optional | Fields to describe the action that displays QR-Codes. | | `saveCardOptions` | [`SaveCardOptions \| undefined`](../../doc/models/save-card-options.md) | Optional | Describes save-card action fields. | +| `signatureOptions` | [`SignatureOptions \| undefined`](../../doc/models/signature-options.md) | Optional | - | +| `confirmationOptions` | [`ConfirmationOptions \| undefined`](../../doc/models/confirmation-options.md) | Optional | - | | `receiptOptions` | [`ReceiptOptions \| undefined`](../../doc/models/receipt-options.md) | Optional | Describes receipt action fields. | +| `dataCollectionOptions` | [`DataCollectionOptions \| undefined`](../../doc/models/data-collection-options.md) | Optional | - | +| `selectOptions` | [`SelectOptions \| undefined`](../../doc/models/select-options.md) | Optional | - | | `deviceMetadata` | [`DeviceMetadata \| undefined`](../../doc/models/device-metadata.md) | Optional | - | +| `awaitNextAction` | `boolean \| undefined` | Optional | Indicates the action will be linked to another action and requires a waiting dialog to be
displayed instead of returning to the idle screen on completion of the action.

Only supported on SIGNATURE, CONFIRMATION, DATA_COLLECTION, and SELECT types. | +| `awaitNextActionDuration` | `string \| undefined` | Optional | The timeout duration of the waiting dialog as an RFC 3339 duration, after which the
waiting dialog will no longer be displayed and the Terminal will return to the idle screen.

Default: 5 minutes from when the waiting dialog is displayed

Maximum: 5 minutes | ## Example (as JSON) diff --git a/doc/models/update-subscription-request.md b/doc/models/update-subscription-request.md index 04f56891..8d18f51e 100644 --- a/doc/models/update-subscription-request.md +++ b/doc/models/update-subscription-request.md @@ -12,7 +12,7 @@ Defines input parameters in a request to the | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription` | [`Subscription \| undefined`](../../doc/models/subscription.md) | Optional | Represents a subscription to a subscription plan by a subscriber.

For an overview of the `Subscription` type, see
[Subscription object](https://developer.squareup.com/docs/subscriptions-api/overview#subscription-object-overview). | +| `subscription` | [`Subscription \| undefined`](../../doc/models/subscription.md) | Optional | Represents a subscription purchased by a customer.

For more information, see
[Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). | ## Example (as JSON) @@ -27,7 +27,7 @@ Defines input parameters in a request to the "version": 1594155459464, "id": "id4", "location_id": "location_id8", - "plan_id": "plan_id6", + "plan_variation_id": "plan_variation_id8", "customer_id": "customer_id2", "start_date": "start_date8" } diff --git a/doc/models/update-subscription-response.md b/doc/models/update-subscription-response.md index 241c4fa7..c30e99c4 100644 --- a/doc/models/update-subscription-response.md +++ b/doc/models/update-subscription-response.md @@ -13,7 +13,7 @@ Defines output parameters in a response from the | Name | Type | Tags | Description | | --- | --- | --- | --- | | `errors` | [`Error[] \| undefined`](../../doc/models/error.md) | Optional | Errors encountered during the request. | -| `subscription` | [`Subscription \| undefined`](../../doc/models/subscription.md) | Optional | Represents a subscription to a subscription plan by a subscriber.

For an overview of the `Subscription` type, see
[Subscription object](https://developer.squareup.com/docs/subscriptions-api/overview#subscription-object-overview). | +| `subscription` | [`Subscription \| undefined`](../../doc/models/subscription.md) | Optional | Represents a subscription purchased by a customer.

For more information, see
[Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). | ## Example (as JSON) @@ -35,6 +35,7 @@ Defines output parameters in a response from the "status": "ACTIVE", "timezone": "America/Los_Angeles", "version": 1594311617331, + "plan_variation_id": "plan_variation_id8", "start_date": "start_date8" }, "errors": [ diff --git a/package.json b/package.json index 00611d78..076f2925 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "27.0.0", + "version": "28.0.0", "license": "MIT", "sideEffects": false, "main": "dist/cjs/index.js", @@ -45,7 +45,7 @@ "uuid": "^8.3.0" }, "dependencies": { - "@apimatic/authentication-adapters": "^0.3.0", + "@apimatic/authentication-adapters": "^0.5.0", "@apimatic/axios-client-adapter": "^0.2.0", "@apimatic/core": "^0.10.0", "@apimatic/json-bigint": "^1.2.0", diff --git a/src/api/oAuthApi.ts b/src/api/oAuthApi.ts index c29cb8c5..a717e783 100644 --- a/src/api/oAuthApi.ts +++ b/src/api/oAuthApi.ts @@ -50,11 +50,11 @@ export class OAuthApi extends BaseApi { * Authorization: Client APPLICATION_SECRET * ``` * - * Replace `APPLICATION_SECRET` with the application secret on the Credentials + * Replace `APPLICATION_SECRET` with the application secret on the **Credentials** * page in the [Developer Dashboard](https://developer.squareup.com/apps). * - * @param clientId Your application ID, which is available in the OAuth page in the - * [Developer Dashboard](https://developer.squareup.com/apps). + * @param clientId Your application ID, which is available on the **OAuth** page in + * the [Developer Dashboard](https://developer.squareup.com/apps). * @param body An object containing the fields to POST for the request. See * the corresponding object definition for field details. * @param authorization Client APPLICATION_SECRET @@ -97,8 +97,8 @@ export class OAuthApi extends BaseApi { * Authorization: Client APPLICATION_SECRET * ``` * - * Replace `APPLICATION_SECRET` with the application secret on the OAuth - * page for your application on the Developer Dashboard. + * Replace `APPLICATION_SECRET` with the application secret on the **OAuth** + * page for your application in the Developer Dashboard. * * @param body An object containing the fields to POST for the request. See * the corresponding object definition for field details. @@ -130,7 +130,7 @@ export class OAuthApi extends BaseApi { * The `grant_type` parameter specifies the type of OAuth request. If * `grant_type` is `authorization_code`, you must include the authorization * code you received when a seller granted you authorization. If `grant_type` - * is `refresh_token`, you must provide a valid refresh token. If you are using + * is `refresh_token`, you must provide a valid refresh token. If you're using * an old version of the Square APIs (prior to March 13, 2019), `grant_type` * can be `migration_token` and you must provide a valid migration token. * diff --git a/src/api/subscriptionsApi.ts b/src/api/subscriptionsApi.ts index 01d9ed81..024421bc 100644 --- a/src/api/subscriptionsApi.ts +++ b/src/api/subscriptionsApi.ts @@ -68,13 +68,16 @@ import { BaseApi } from './baseApi'; export class SubscriptionsApi extends BaseApi { /** - * Creates a subscription to a subscription plan by a customer. + * Enrolls a customer in a subscription. * * If you provide a card on file in the request, Square charges the card for - * the subscription. Otherwise, Square bills an invoice to the customer's email + * the subscription. Otherwise, Square sends an invoice to the customer's email * address. The subscription starts immediately, unless the request includes * the optional `start_date`. Each individual subscription is associated with a particular location. * + * For more information, see [Create a subscription](https://developer.squareup.com/docs/subscriptions- + * api/manage-subscriptions#create-a-subscription). + * * @param body An object containing the fields to POST for the request. * See the corresponding object definition for field details. * @return Response from the API call @@ -108,10 +111,6 @@ export class SubscriptionsApi extends BaseApi { * first by location, within location by customer ID, and within * customer by subscription creation date. * - * For more information, see - * [Retrieve subscriptions](https://developer.squareup.com/docs/subscriptions-api/overview#retrieve- - * subscriptions). - * * @param body An object containing the fields to POST for the request. * See the corresponding object definition for field * details. @@ -131,7 +130,7 @@ export class SubscriptionsApi extends BaseApi { } /** - * Retrieves a subscription. + * Retrieves a specific subscription. * * @param subscriptionId The ID of the subscription to retrieve. * @param include A query parameter to specify related information to be included in the response. @@ -155,8 +154,8 @@ export class SubscriptionsApi extends BaseApi { } /** - * Updates a subscription. You can set, modify, and clear the - * `subscription` field values. + * Updates a subscription by modifying or clearing `subscription` field values. + * To clear a field, set its value to `null`. * * @param subscriptionId The ID of the subscription to update. * @param body An object containing the fields to POST for the @@ -205,9 +204,9 @@ export class SubscriptionsApi extends BaseApi { } /** - * Schedules a `CANCEL` action to cancel an active subscription - * by setting the `canceled_date` field to the end of the active billing period - * and changing the subscription status from ACTIVE to CANCELED after this date. + * Schedules a `CANCEL` action to cancel an active subscription. This + * sets the `canceled_date` field to the end of the active billing period. After this date, + * the subscription status changes from ACTIVE to CANCELED. * * @param subscriptionId The ID of the subscription to cancel. * @return Response from the API call @@ -225,14 +224,15 @@ export class SubscriptionsApi extends BaseApi { } /** - * Lists all events for a specific subscription. + * Lists all [events](https://developer.squareup.com/docs/subscriptions-api/actions-events) for a + * specific subscription. * * @param subscriptionId The ID of the subscription to retrieve the events for. * @param cursor When the total number of resulting subscription events exceeds the limit of a * paged response, specify the cursor returned from a preceding response here to * fetch the next set of results. If the cursor is unset, the response contains the * last page of the results. For more information, see [Pagination](https: - * //developer.squareup.com/docs/working-with-apis/pagination). + * //developer.squareup.com/docs/build-basics/common-api-patterns/pagination). * @param limit The upper limit on the number of subscription events to return in a paged * response. * @return Response from the API call @@ -306,7 +306,9 @@ export class SubscriptionsApi extends BaseApi { } /** - * Schedules a `SWAP_PLAN` action to swap a subscription plan in an existing subscription. + * Schedules a `SWAP_PLAN` action to swap a subscription plan variation in an existing subscription. + * For more information, see [Swap Subscription Plan Variations](https://developer.squareup. + * com/docs/subscriptions-api/swap-plan-variations). * * @param subscriptionId The ID of the subscription to swap the subscription plan for. * @param body An object containing the fields to POST for the request. See diff --git a/src/api/terminalApi.ts b/src/api/terminalApi.ts index 2b7b944a..ae7c3094 100644 --- a/src/api/terminalApi.ts +++ b/src/api/terminalApi.ts @@ -35,6 +35,10 @@ import { CreateTerminalRefundResponse, createTerminalRefundResponseSchema, } from '../models/createTerminalRefundResponse'; +import { + DismissTerminalActionResponse, + dismissTerminalActionResponseSchema, +} from '../models/dismissTerminalActionResponse'; import { GetTerminalActionResponse, getTerminalActionResponseSchema, @@ -122,7 +126,7 @@ export class TerminalApi extends BaseApi { * Retrieves a Terminal action request by `action_id`. Terminal action requests are available for 30 * days. * - * @param actionId Unique ID for the desired `TerminalAction` + * @param actionId Unique ID for the desired `TerminalAction`. * @return Response from the API call */ async getTerminalAction( @@ -138,7 +142,7 @@ export class TerminalApi extends BaseApi { /** * Cancels a Terminal action request if the status of the request permits it. * - * @param actionId Unique ID for the desired `TerminalAction` + * @param actionId Unique ID for the desired `TerminalAction`. * @return Response from the API call */ async cancelTerminalAction( @@ -151,6 +155,25 @@ export class TerminalApi extends BaseApi { return req.callAsJson(cancelTerminalActionResponseSchema, requestOptions); } + /** + * Dismisses a Terminal action request if the status and type of the request permits it. + * + * See [Link and Dismiss Actions](https://developer.squareup.com/docs/terminal-api/advanced- + * features/custom-workflows/link-and-dismiss-actions) for more details. + * + * @param actionId Unique ID for the `TerminalAction` associated with the waiting dialog to be dismissed. + * @return Response from the API call + */ + async dismissTerminalAction( + actionId: string, + requestOptions?: RequestOptions + ): Promise> { + const req = this.createRequest('POST'); + const mapped = req.prepareArgs({ actionId: [actionId, string()] }); + req.appendTemplatePath`/v2/terminals/actions/${mapped.actionId}/dismiss`; + return req.callAsJson(dismissTerminalActionResponseSchema, requestOptions); + } + /** * Creates a Terminal checkout request and sends it to the specified device to take a payment * for the requested amount. diff --git a/src/client.ts b/src/client.ts index c120f7a5..a3e39c63 100644 --- a/src/client.ts +++ b/src/client.ts @@ -67,7 +67,7 @@ import { import { HttpClient } from './clientAdapter'; /** Current SDK version */ -export const SDK_VERSION = '27.0.0'; +export const SDK_VERSION = '28.0.0'; export class Client implements ClientInterface { private _config: Readonly; private _timeout: number; @@ -131,7 +131,7 @@ export class Client implements ClientInterface { ? this._config.httpClientOptions.timeout : this._config.timeout; this._userAgent = updateUserAgent( - 'Square-TypeScript-SDK/27.0.0 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}', + 'Square-TypeScript-SDK/28.0.0 ({api-version}) {engine}/{engine-version} ({os-info}) {detail}', this._config.squareVersion, this._config.userAgentDetail ); diff --git a/src/defaultConfiguration.ts b/src/defaultConfiguration.ts index 4a8c56a0..177df5fa 100644 --- a/src/defaultConfiguration.ts +++ b/src/defaultConfiguration.ts @@ -4,7 +4,7 @@ import { RetryConfiguration } from './core'; /** Default values for the configuration parameters of the client. */ export const DEFAULT_CONFIGURATION: Configuration = { timeout: 60000, - squareVersion: '2023-05-17', + squareVersion: '2023-06-08', additionalHeaders: {}, userAgentDetail: '', environment: Environment.Production, diff --git a/src/index.ts b/src/index.ts index 782ec619..b08db7b1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -204,6 +204,7 @@ export type { CatalogQuickAmount } from './models/catalogQuickAmount'; export type { CatalogQuickAmountsSettings } from './models/catalogQuickAmountsSettings'; export type { CatalogStockConversion } from './models/catalogStockConversion'; export type { CatalogSubscriptionPlan } from './models/catalogSubscriptionPlan'; +export type { CatalogSubscriptionPlanVariation } from './models/catalogSubscriptionPlanVariation'; export type { CatalogTax } from './models/catalogTax'; export type { CatalogTimePeriod } from './models/catalogTimePeriod'; export type { CatalogV1Id } from './models/catalogV1Id'; @@ -215,8 +216,11 @@ export type { CheckoutOptions } from './models/checkoutOptions'; export type { ClearpayDetails } from './models/clearpayDetails'; export type { CloneOrderRequest } from './models/cloneOrderRequest'; export type { CloneOrderResponse } from './models/cloneOrderResponse'; +export type { CollectedData } from './models/collectedData'; export type { CompletePaymentRequest } from './models/completePaymentRequest'; export type { CompletePaymentResponse } from './models/completePaymentResponse'; +export type { ConfirmationDecision } from './models/confirmationDecision'; +export type { ConfirmationOptions } from './models/confirmationOptions'; export type { Coordinates } from './models/coordinates'; export type { CreateBookingCustomAttributeDefinitionRequest } from './models/createBookingCustomAttributeDefinitionRequest'; export type { CreateBookingCustomAttributeDefinitionResponse } from './models/createBookingCustomAttributeDefinitionResponse'; @@ -308,6 +312,7 @@ export type { CustomerSort } from './models/customerSort'; export type { CustomerTaxIds } from './models/customerTaxIds'; export type { CustomerTextFilter } from './models/customerTextFilter'; export type { CustomField } from './models/customField'; +export type { DataCollectionOptions } from './models/dataCollectionOptions'; export type { DateRange } from './models/dateRange'; export type { DeleteBookingCustomAttributeDefinitionResponse } from './models/deleteBookingCustomAttributeDefinitionResponse'; export type { DeleteBookingCustomAttributeResponse } from './models/deleteBookingCustomAttributeResponse'; @@ -348,6 +353,7 @@ export type { DeviceDetails } from './models/deviceDetails'; export type { DeviceMetadata } from './models/deviceMetadata'; export type { DigitalWalletDetails } from './models/digitalWalletDetails'; export type { DisableCardResponse } from './models/disableCardResponse'; +export type { DismissTerminalActionResponse } from './models/dismissTerminalActionResponse'; export type { Dispute } from './models/dispute'; export type { DisputedPayment } from './models/disputedPayment'; export type { DisputeEvidence } from './models/disputeEvidence'; @@ -625,10 +631,13 @@ export type { PayOrderResponse } from './models/payOrderResponse'; export type { Payout } from './models/payout'; export type { PayoutEntry } from './models/payoutEntry'; export type { PayoutFee } from './models/payoutFee'; +export type { Phase } from './models/phase'; +export type { PhaseInput } from './models/phaseInput'; export type { PrePopulatedData } from './models/prePopulatedData'; export type { ProcessingFee } from './models/processingFee'; export type { PublishInvoiceRequest } from './models/publishInvoiceRequest'; export type { PublishInvoiceResponse } from './models/publishInvoiceResponse'; +export type { QrCodeOptions } from './models/qrCodeOptions'; export type { QuantityRatio } from './models/quantityRatio'; export type { QuickPay } from './models/quickPay'; export type { Range } from './models/range'; @@ -763,6 +772,8 @@ export type { SearchVendorsRequestFilter } from './models/searchVendorsRequestFi export type { SearchVendorsRequestSort } from './models/searchVendorsRequestSort'; export type { SearchVendorsResponse } from './models/searchVendorsResponse'; export type { SegmentFilter } from './models/segmentFilter'; +export type { SelectOption } from './models/selectOption'; +export type { SelectOptions } from './models/selectOptions'; export type { Shift } from './models/shift'; export type { ShiftFilter } from './models/shiftFilter'; export type { ShiftQuery } from './models/shiftQuery'; @@ -770,6 +781,8 @@ export type { ShiftSort } from './models/shiftSort'; export type { ShiftWage } from './models/shiftWage'; export type { ShiftWorkday } from './models/shiftWorkday'; export type { ShippingFee } from './models/shippingFee'; +export type { SignatureImage } from './models/signatureImage'; +export type { SignatureOptions } from './models/signatureOptions'; export type { Site } from './models/site'; export type { Snippet } from './models/snippet'; export type { SnippetResponse } from './models/snippetResponse'; @@ -782,6 +795,7 @@ export type { SubscriptionAction } from './models/subscriptionAction'; export type { SubscriptionEvent } from './models/subscriptionEvent'; export type { SubscriptionEventInfo } from './models/subscriptionEventInfo'; export type { SubscriptionPhase } from './models/subscriptionPhase'; +export type { SubscriptionPricing } from './models/subscriptionPricing'; export type { SubscriptionSource } from './models/subscriptionSource'; export type { SubscriptionTestResult } from './models/subscriptionTestResult'; export type { SwapPlanRequest } from './models/swapPlanRequest'; diff --git a/src/models/cancelSubscriptionResponse.ts b/src/models/cancelSubscriptionResponse.ts index aabc75a3..1523def6 100644 --- a/src/models/cancelSubscriptionResponse.ts +++ b/src/models/cancelSubscriptionResponse.ts @@ -14,9 +14,9 @@ export interface CancelSubscriptionResponse { /** Errors encountered during the request. */ errors?: Error[]; /** - * Represents a subscription to a subscription plan by a subscriber. - * For an overview of the `Subscription` type, see - * [Subscription object](https://developer.squareup.com/docs/subscriptions-api/overview#subscription-object-overview). + * Represents a subscription purchased by a customer. + * For more information, see + * [Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). */ subscription?: Subscription; /** A list of a single `CANCEL` action scheduled for the subscription. */ diff --git a/src/models/catalogCustomAttributeDefinition.ts b/src/models/catalogCustomAttributeDefinition.ts index 53b0cff2..8ed9aa46 100644 --- a/src/models/catalogCustomAttributeDefinition.ts +++ b/src/models/catalogCustomAttributeDefinition.ts @@ -20,10 +20,7 @@ import { CatalogCustomAttributeDefinitionStringConfig, catalogCustomAttributeDefinitionStringConfigSchema, } from './catalogCustomAttributeDefinitionStringConfig'; -import { - SourceApplication, - sourceApplicationSchema, -} from './sourceApplication'; +import { SourceApplication, sourceApplicationSchema } from './sourceApplication'; /** * Contains information defining a custom attribute. Custom attributes are diff --git a/src/models/catalogObject.ts b/src/models/catalogObject.ts index 498a4824..2517e057 100644 --- a/src/models/catalogObject.ts +++ b/src/models/catalogObject.ts @@ -22,10 +22,7 @@ import { import { CatalogDiscount, catalogDiscountSchema } from './catalogDiscount'; import { CatalogImage, catalogImageSchema } from './catalogImage'; import { CatalogItem, catalogItemSchema } from './catalogItem'; -import { - CatalogItemOption, - catalogItemOptionSchema, -} from './catalogItemOption'; +import { CatalogItemOption, catalogItemOptionSchema } from './catalogItemOption'; import { CatalogItemOptionValue, catalogItemOptionValueSchema, @@ -47,10 +44,7 @@ import { CatalogPricingRule, catalogPricingRuleSchema, } from './catalogPricingRule'; -import { - CatalogProductSet, - catalogProductSetSchema, -} from './catalogProductSet'; +import { CatalogProductSet, catalogProductSetSchema } from './catalogProductSet'; import { CatalogQuickAmountsSettings, catalogQuickAmountsSettingsSchema, @@ -60,10 +54,7 @@ import { catalogSubscriptionPlanSchema, } from './catalogSubscriptionPlan'; import { CatalogTax, catalogTaxSchema } from './catalogTax'; -import { - CatalogTimePeriod, - catalogTimePeriodSchema, -} from './catalogTimePeriod'; +import { CatalogTimePeriod, catalogTimePeriodSchema } from './catalogTimePeriod'; import { CatalogV1Id, catalogV1IdSchema } from './catalogV1Id'; /** @@ -203,8 +194,8 @@ export interface CatalogObject { */ measurementUnitData?: CatalogMeasurementUnit; /** - * Describes a subscription plan. For more information, see - * [Set Up and Manage a Subscription Plan](https://developer.squareup.com/docs/subscriptions-api/setup-plan). + * Describes a subscription plan. A subscription plan represents what you want to sell in a subscription model, and includes references to each of the associated subscription plan variations. + * For more information, see [Subscription Plans and Variations](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations). */ subscriptionPlanData?: CatalogSubscriptionPlan; /** A group of variations for a `CatalogItem`. */ diff --git a/src/models/catalogQuery.ts b/src/models/catalogQuery.ts index a2ff71dc..6bf656aa 100644 --- a/src/models/catalogQuery.ts +++ b/src/models/catalogQuery.ts @@ -1,8 +1,5 @@ import { lazy, object, optional, Schema } from '../schema'; -import { - CatalogQueryExact, - catalogQueryExactSchema, -} from './catalogQueryExact'; +import { CatalogQueryExact, catalogQueryExactSchema } from './catalogQueryExact'; import { CatalogQueryItemsForItemOptions, catalogQueryItemsForItemOptionsSchema, @@ -23,10 +20,7 @@ import { CatalogQueryPrefix, catalogQueryPrefixSchema, } from './catalogQueryPrefix'; -import { - CatalogQueryRange, - catalogQueryRangeSchema, -} from './catalogQueryRange'; +import { CatalogQueryRange, catalogQueryRangeSchema } from './catalogQueryRange'; import { CatalogQuerySet, catalogQuerySetSchema } from './catalogQuerySet'; import { CatalogQuerySortedAttribute, diff --git a/src/models/catalogSubscriptionPlan.ts b/src/models/catalogSubscriptionPlan.ts index 6227cb6f..dadca681 100644 --- a/src/models/catalogSubscriptionPlan.ts +++ b/src/models/catalogSubscriptionPlan.ts @@ -1,5 +1,6 @@ import { array, + boolean, lazy, nullable, object, @@ -7,14 +8,12 @@ import { Schema, string, } from '../schema'; -import { - SubscriptionPhase, - subscriptionPhaseSchema, -} from './subscriptionPhase'; +import { CatalogObject, catalogObjectSchema } from './catalogObject'; +import { SubscriptionPhase, subscriptionPhaseSchema } from './subscriptionPhase'; /** - * Describes a subscription plan. For more information, see - * [Set Up and Manage a Subscription Plan](https://developer.squareup.com/docs/subscriptions-api/setup-plan). + * Describes a subscription plan. A subscription plan represents what you want to sell in a subscription model, and includes references to each of the associated subscription plan variations. + * For more information, see [Subscription Plans and Variations](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations). */ export interface CatalogSubscriptionPlan { /** The name of the plan. */ @@ -24,6 +23,14 @@ export interface CatalogSubscriptionPlan { * This field it required. Not including this field will throw a REQUIRED_FIELD_MISSING error */ phases?: SubscriptionPhase[] | null; + /** The list of subscription plan variations available for this product */ + subscriptionPlanVariations?: CatalogObject[] | null; + /** The list of IDs of `CatalogItems` that are eligible for subscription by this SubscriptionPlan's variations. */ + eligibleItemIds?: string[] | null; + /** The list of IDs of `CatalogCategory` that are eligible for subscription by this SubscriptionPlan's variations. */ + eligibleCategoryIds?: string[] | null; + /** If true, all items in the merchant's catalog are subscribable by this SubscriptionPlan. */ + allItems?: boolean | null; } export const catalogSubscriptionPlanSchema: Schema = object( @@ -33,5 +40,15 @@ export const catalogSubscriptionPlanSchema: Schema = ob 'phases', optional(nullable(array(lazy(() => subscriptionPhaseSchema)))), ], + subscriptionPlanVariations: [ + 'subscription_plan_variations', + optional(nullable(array(lazy(() => catalogObjectSchema)))), + ], + eligibleItemIds: ['eligible_item_ids', optional(nullable(array(string())))], + eligibleCategoryIds: [ + 'eligible_category_ids', + optional(nullable(array(string()))), + ], + allItems: ['all_items', optional(nullable(boolean()))], } ); diff --git a/src/models/catalogSubscriptionPlanVariation.ts b/src/models/catalogSubscriptionPlanVariation.ts new file mode 100644 index 00000000..68cac955 --- /dev/null +++ b/src/models/catalogSubscriptionPlanVariation.ts @@ -0,0 +1,31 @@ +import { + array, + lazy, + nullable, + object, + optional, + Schema, + string, +} from '../schema'; +import { SubscriptionPhase, subscriptionPhaseSchema } from './subscriptionPhase'; + +/** + * Describes a subscription plan variation. A subscription plan variation represents how the subscription for a product or service is sold. + * For more information, see [Subscription Plans and Variations](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations). + */ +export interface CatalogSubscriptionPlanVariation { + /** The name of the plan variation. */ + name: string; + /** A list containing each [SubscriptionPhase](entity:SubscriptionPhase) for this plan variation. */ + phases: SubscriptionPhase[]; + /** The id of the subscription plan, if there is one. */ + subscriptionPlanId?: string | null; +} + +export const catalogSubscriptionPlanVariationSchema: Schema = object( + { + name: ['name', string()], + phases: ['phases', array(lazy(() => subscriptionPhaseSchema))], + subscriptionPlanId: ['subscription_plan_id', optional(nullable(string()))], + } +); diff --git a/src/models/checkoutOptions.ts b/src/models/checkoutOptions.ts index bf70d9c7..876dd131 100644 --- a/src/models/checkoutOptions.ts +++ b/src/models/checkoutOptions.ts @@ -43,6 +43,10 @@ export interface CheckoutOptions { */ appFeeMoney?: Money; shippingFee?: ShippingFee; + /** Indicates whether to include the `Add coupon` section for the buyer to provide a Square marketing coupon in the payment form. */ + enableCoupon?: boolean | null; + /** Indicates whether to include the `REWARDS` section for the buyer to opt in to loyalty, redeem rewards in the payment form, or both. */ + enableLoyalty?: boolean | null; } export const checkoutOptionsSchema: Schema = object({ @@ -67,4 +71,6 @@ export const checkoutOptionsSchema: Schema = object({ ], appFeeMoney: ['app_fee_money', optional(lazy(() => moneySchema))], shippingFee: ['shipping_fee', optional(lazy(() => shippingFeeSchema))], + enableCoupon: ['enable_coupon', optional(nullable(boolean()))], + enableLoyalty: ['enable_loyalty', optional(nullable(boolean()))], }); diff --git a/src/models/collectedData.ts b/src/models/collectedData.ts new file mode 100644 index 00000000..e2eadbb8 --- /dev/null +++ b/src/models/collectedData.ts @@ -0,0 +1,10 @@ +import { object, optional, Schema, string } from '../schema'; + +export interface CollectedData { + /** The buyer's input text. */ + inputText?: string; +} + +export const collectedDataSchema: Schema = object({ + inputText: ['input_text', optional(string())], +}); diff --git a/src/models/confirmationDecision.ts b/src/models/confirmationDecision.ts new file mode 100644 index 00000000..dca1bcc5 --- /dev/null +++ b/src/models/confirmationDecision.ts @@ -0,0 +1,10 @@ +import { boolean, object, optional, Schema } from '../schema'; + +export interface ConfirmationDecision { + /** The buyer's decision to the displayed terms. */ + hasAgreed?: boolean; +} + +export const confirmationDecisionSchema: Schema = object({ + hasAgreed: ['has_agreed', optional(boolean())], +}); diff --git a/src/models/confirmationOptions.ts b/src/models/confirmationOptions.ts new file mode 100644 index 00000000..a4c2a480 --- /dev/null +++ b/src/models/confirmationOptions.ts @@ -0,0 +1,25 @@ +import { lazy, nullable, object, optional, Schema, string } from '../schema'; +import { + ConfirmationDecision, + confirmationDecisionSchema, +} from './confirmationDecision'; + +export interface ConfirmationOptions { + /** The title text to display in the confirmation screen flow on the Terminal. */ + title: string; + /** The agreement details to display in the confirmation flow on the Terminal. */ + body: string; + /** The button text to display indicating the customer agrees to the displayed terms. */ + agreeButtonText: string; + /** The button text to display indicating the customer does not agree to the displayed terms. */ + disagreeButtonText?: string | null; + decision?: ConfirmationDecision; +} + +export const confirmationOptionsSchema: Schema = object({ + title: ['title', string()], + body: ['body', string()], + agreeButtonText: ['agree_button_text', string()], + disagreeButtonText: ['disagree_button_text', optional(nullable(string()))], + decision: ['decision', optional(lazy(() => confirmationDecisionSchema))], +}); diff --git a/src/models/createMobileAuthorizationCodeResponse.ts b/src/models/createMobileAuthorizationCodeResponse.ts index 0cf7b1d7..ee667f56 100644 --- a/src/models/createMobileAuthorizationCodeResponse.ts +++ b/src/models/createMobileAuthorizationCodeResponse.ts @@ -1,4 +1,4 @@ -import { lazy, object, optional, Schema, string } from '../schema'; +import { array, lazy, object, optional, Schema, string } from '../schema'; import { Error, errorSchema } from './error'; /** @@ -16,17 +16,14 @@ export interface CreateMobileAuthorizationCodeResponse { * [RFC 3339](https://tools.ietf.org/html/rfc3339) format (for example, "2016-09-04T23:59:33.123Z"). */ expiresAt?: string; - /** - * Represents an error encountered during a request to the Connect API. - * See [Handling errors](https://developer.squareup.com/docs/build-basics/handling-errors) for more information. - */ - error?: Error; + /** Any errors that occurred during the request. */ + errors?: Error[]; } export const createMobileAuthorizationCodeResponseSchema: Schema = object( { authorizationCode: ['authorization_code', optional(string())], expiresAt: ['expires_at', optional(string())], - error: ['error', optional(lazy(() => errorSchema))], + errors: ['errors', optional(array(lazy(() => errorSchema)))], } ); diff --git a/src/models/createSubscriptionRequest.ts b/src/models/createSubscriptionRequest.ts index 86adc78a..304955a2 100644 --- a/src/models/createSubscriptionRequest.ts +++ b/src/models/createSubscriptionRequest.ts @@ -1,5 +1,6 @@ -import { lazy, object, optional, Schema, string } from '../schema'; +import { array, lazy, object, optional, Schema, string } from '../schema'; import { Money, moneySchema } from './money'; +import { Phase, phaseSchema } from './phase'; import { SubscriptionSource, subscriptionSourceSchema, @@ -14,19 +15,22 @@ export interface CreateSubscriptionRequest { * A unique string that identifies this `CreateSubscription` request. * If you do not provide a unique string (or provide an empty string as the value), * the endpoint treats each request as independent. - * For more information, see [Idempotency keys](https://developer.squareup.com/docs/working-with-apis/idempotency). + * For more information, see [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). */ idempotencyKey?: string; /** The ID of the location the subscription is associated with. */ locationId: string; /** - * The ID of the subscription plan created using the Catalog API. + * The ID of the [subscription plan](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations) created using the Catalog API. + * Deprecated in favour of `plan_variation_id`. * For more information, see * [Set Up and Manage a Subscription Plan](https://developer.squareup.com/docs/subscriptions-api/setup-plan) and * [Subscriptions Walkthrough](https://developer.squareup.com/docs/subscriptions-api/walkthrough). */ - planId: string; - /** The ID of the [customer](entity:Customer) subscribing to the subscription plan. */ + planId?: string; + /** The ID of the [subscription plan variation](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations#plan-variations) created using the Catalog API. */ + planVariationId?: string; + /** The ID of the [customer](entity:Customer) subscribing to the subscription plan variation. */ customerId: string; /** * The `YYYY-MM-DD`-formatted date to start the subscription. @@ -35,7 +39,7 @@ export interface CreateSubscriptionRequest { startDate?: string; /** * The `YYYY-MM-DD`-formatted date when the newly created subscription is scheduled for cancellation. - * This date overrides the cancellation date set in the plan configuration. + * This date overrides the cancellation date set in the plan variation configuration. * If the cancellation date is earlier than the end date of a subscription cycle, the subscription stops * 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` @@ -61,8 +65,7 @@ export interface CreateSubscriptionRequest { priceOverrideMoney?: Money; /** * The ID of the [subscriber's](entity:Customer) [card](entity:Card) to charge. - * If it is not specified, the subscriber receives an invoice via email. For an example to - * create a customer profile for a subscriber and add a card on file, see [Subscriptions Walkthrough](https://developer.squareup.com/docs/subscriptions-api/walkthrough). + * If it is not specified, the subscriber receives an invoice via email with a link to pay for their subscription. */ cardId?: string; /** @@ -74,13 +77,16 @@ export interface CreateSubscriptionRequest { timezone?: string; /** The origination details of the subscription. */ source?: SubscriptionSource; + /** array of phases for this subscription */ + phases?: Phase[]; } export const createSubscriptionRequestSchema: Schema = object( { idempotencyKey: ['idempotency_key', optional(string())], locationId: ['location_id', string()], - planId: ['plan_id', string()], + planId: ['plan_id', optional(string())], + planVariationId: ['plan_variation_id', optional(string())], customerId: ['customer_id', string()], startDate: ['start_date', optional(string())], canceledDate: ['canceled_date', optional(string())], @@ -92,5 +98,6 @@ export const createSubscriptionRequestSchema: Schema cardId: ['card_id', optional(string())], timezone: ['timezone', optional(string())], source: ['source', optional(lazy(() => subscriptionSourceSchema))], + phases: ['phases', optional(array(lazy(() => phaseSchema)))], } ); diff --git a/src/models/createSubscriptionResponse.ts b/src/models/createSubscriptionResponse.ts index 2eb8d0ac..a1015229 100644 --- a/src/models/createSubscriptionResponse.ts +++ b/src/models/createSubscriptionResponse.ts @@ -10,9 +10,9 @@ export interface CreateSubscriptionResponse { /** Errors encountered during the request. */ errors?: Error[]; /** - * Represents a subscription to a subscription plan by a subscriber. - * For an overview of the `Subscription` type, see - * [Subscription object](https://developer.squareup.com/docs/subscriptions-api/overview#subscription-object-overview). + * Represents a subscription purchased by a customer. + * For more information, see + * [Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). */ subscription?: Subscription; } diff --git a/src/models/dataCollectionOptions.ts b/src/models/dataCollectionOptions.ts new file mode 100644 index 00000000..4a0482d2 --- /dev/null +++ b/src/models/dataCollectionOptions.ts @@ -0,0 +1,27 @@ +import { lazy, object, optional, Schema, string } from '../schema'; +import { CollectedData, collectedDataSchema } from './collectedData'; + +export interface DataCollectionOptions { + /** The title text to display in the data collection flow on the Terminal. */ + title: string; + /** + * The body text to display under the title in the data collection screen flow on the + * Terminal. + */ + body: string; + /** Describes the input type of the data. */ + inputType: string; + collectedData?: CollectedData; +} + +export const dataCollectionOptionsSchema: Schema = object( + { + title: ['title', string()], + body: ['body', string()], + inputType: ['input_type', string()], + collectedData: [ + 'collected_data', + optional(lazy(() => collectedDataSchema)), + ], + } +); diff --git a/src/models/deleteSubscriptionActionResponse.ts b/src/models/deleteSubscriptionActionResponse.ts index f876fa36..8cf9ef3c 100644 --- a/src/models/deleteSubscriptionActionResponse.ts +++ b/src/models/deleteSubscriptionActionResponse.ts @@ -10,9 +10,9 @@ export interface DeleteSubscriptionActionResponse { /** Errors encountered during the request. */ errors?: Error[]; /** - * Represents a subscription to a subscription plan by a subscriber. - * For an overview of the `Subscription` type, see - * [Subscription object](https://developer.squareup.com/docs/subscriptions-api/overview#subscription-object-overview). + * Represents a subscription purchased by a customer. + * For more information, see + * [Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). */ subscription?: Subscription; } diff --git a/src/models/dismissTerminalActionResponse.ts b/src/models/dismissTerminalActionResponse.ts new file mode 100644 index 00000000..6f77cba7 --- /dev/null +++ b/src/models/dismissTerminalActionResponse.ts @@ -0,0 +1,17 @@ +import { array, lazy, object, optional, Schema } from '../schema'; +import { Error, errorSchema } from './error'; +import { TerminalAction, terminalActionSchema } from './terminalAction'; + +export interface DismissTerminalActionResponse { + /** Information on errors encountered during the request. */ + errors?: Error[]; + /** Represents an action processed by the Square Terminal. */ + action?: TerminalAction; +} + +export const dismissTerminalActionResponseSchema: Schema = object( + { + errors: ['errors', optional(array(lazy(() => errorSchema)))], + action: ['action', optional(lazy(() => terminalActionSchema))], + } +); diff --git a/src/models/employeeWage.ts b/src/models/employeeWage.ts index 91cae460..f909aaf5 100644 --- a/src/models/employeeWage.ts +++ b/src/models/employeeWage.ts @@ -1,10 +1,7 @@ import { lazy, nullable, object, optional, Schema, string } from '../schema'; import { Money, moneySchema } from './money'; -/** - * The hourly wage rate that an employee earns on a `Shift` for doing the job - * specified by the `title` property of this object. Deprecated at version 2020-08-26. Use `TeamMemberWage` instead. - */ +/** The hourly wage rate that an employee earns on a `Shift` for doing the job specified by the `title` property of this object. Deprecated at version 2020-08-26. Use [TeamMemberWage](entity:TeamMemberWage). */ export interface EmployeeWage { /** The UUID for this object. */ id?: string; diff --git a/src/models/getEmployeeWageResponse.ts b/src/models/getEmployeeWageResponse.ts index 17f125b2..38f16965 100644 --- a/src/models/getEmployeeWageResponse.ts +++ b/src/models/getEmployeeWageResponse.ts @@ -8,10 +8,7 @@ import { Error, errorSchema } from './error'; * the request resulted in errors. */ export interface GetEmployeeWageResponse { - /** - * The hourly wage rate that an employee earns on a `Shift` for doing the job - * specified by the `title` property of this object. Deprecated at version 2020-08-26. Use `TeamMemberWage` instead. - */ + /** The hourly wage rate that an employee earns on a `Shift` for doing the job specified by the `title` property of this object. Deprecated at version 2020-08-26. Use [TeamMemberWage](entity:TeamMemberWage). */ employeeWage?: EmployeeWage; /** Any errors that occurred during the request. */ errors?: Error[]; diff --git a/src/models/inventoryAdjustment.ts b/src/models/inventoryAdjustment.ts index a88c8403..c41dd6b5 100644 --- a/src/models/inventoryAdjustment.ts +++ b/src/models/inventoryAdjustment.ts @@ -4,10 +4,7 @@ import { inventoryAdjustmentGroupSchema, } from './inventoryAdjustmentGroup'; import { Money, moneySchema } from './money'; -import { - SourceApplication, - sourceApplicationSchema, -} from './sourceApplication'; +import { SourceApplication, sourceApplicationSchema } from './sourceApplication'; /** * Represents a change in state or quantity of product inventory at a diff --git a/src/models/inventoryChange.ts b/src/models/inventoryChange.ts index 20e9a5dc..20e3d2df 100644 --- a/src/models/inventoryChange.ts +++ b/src/models/inventoryChange.ts @@ -11,10 +11,7 @@ import { InventoryPhysicalCount, inventoryPhysicalCountSchema, } from './inventoryPhysicalCount'; -import { - InventoryTransfer, - inventoryTransferSchema, -} from './inventoryTransfer'; +import { InventoryTransfer, inventoryTransferSchema } from './inventoryTransfer'; /** * Represents a single physical count, inventory, adjustment, or transfer diff --git a/src/models/inventoryPhysicalCount.ts b/src/models/inventoryPhysicalCount.ts index 95cc47fd..9ad38df8 100644 --- a/src/models/inventoryPhysicalCount.ts +++ b/src/models/inventoryPhysicalCount.ts @@ -1,8 +1,5 @@ import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { - SourceApplication, - sourceApplicationSchema, -} from './sourceApplication'; +import { SourceApplication, sourceApplicationSchema } from './sourceApplication'; /** * Represents the quantity of an item variation that is physically present diff --git a/src/models/inventoryTransfer.ts b/src/models/inventoryTransfer.ts index 44fbe8e8..8f0fc422 100644 --- a/src/models/inventoryTransfer.ts +++ b/src/models/inventoryTransfer.ts @@ -1,8 +1,5 @@ import { lazy, nullable, object, optional, Schema, string } from '../schema'; -import { - SourceApplication, - sourceApplicationSchema, -} from './sourceApplication'; +import { SourceApplication, sourceApplicationSchema } from './sourceApplication'; /** * Represents the transfer of a quantity of product inventory at a diff --git a/src/models/listSubscriptionEventsRequest.ts b/src/models/listSubscriptionEventsRequest.ts index 48251e20..7733fef3 100644 --- a/src/models/listSubscriptionEventsRequest.ts +++ b/src/models/listSubscriptionEventsRequest.ts @@ -10,7 +10,7 @@ export interface ListSubscriptionEventsRequest { * When the total number of resulting subscription events exceeds the limit of a paged response, * specify the cursor returned from a preceding response here to fetch the next set of results. * If the cursor is unset, the response contains the last page of the results. - * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). */ cursor?: string | null; /** diff --git a/src/models/listSubscriptionEventsResponse.ts b/src/models/listSubscriptionEventsResponse.ts index 768c2a64..28568b31 100644 --- a/src/models/listSubscriptionEventsResponse.ts +++ b/src/models/listSubscriptionEventsResponse.ts @@ -1,9 +1,6 @@ import { array, lazy, object, optional, Schema, string } from '../schema'; import { Error, errorSchema } from './error'; -import { - SubscriptionEvent, - subscriptionEventSchema, -} from './subscriptionEvent'; +import { SubscriptionEvent, subscriptionEventSchema } from './subscriptionEvent'; /** * Defines output parameters in a response from the @@ -18,7 +15,7 @@ export interface ListSubscriptionEventsResponse { * When the total number of resulting subscription events exceeds the limit of a paged response, * the response includes a cursor for you to use in a subsequent request to fetch the next set of events. * If the cursor is unset, the response contains the last page of the results. - * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). */ cursor?: string; } diff --git a/src/models/listWebhookEventTypesResponse.ts b/src/models/listWebhookEventTypesResponse.ts index 75ced1da..2b187379 100644 --- a/src/models/listWebhookEventTypesResponse.ts +++ b/src/models/listWebhookEventTypesResponse.ts @@ -1,9 +1,6 @@ import { array, lazy, object, optional, Schema, string } from '../schema'; import { Error, errorSchema } from './error'; -import { - EventTypeMetadata, - eventTypeMetadataSchema, -} from './eventTypeMetadata'; +import { EventTypeMetadata, eventTypeMetadataSchema } from './eventTypeMetadata'; /** * Defines the fields that are included in the response body of diff --git a/src/models/loyaltyEvent.ts b/src/models/loyaltyEvent.ts index 651a1ce3..574a2dec 100644 --- a/src/models/loyaltyEvent.ts +++ b/src/models/loyaltyEvent.ts @@ -23,10 +23,7 @@ import { LoyaltyEventExpirePoints, loyaltyEventExpirePointsSchema, } from './loyaltyEventExpirePoints'; -import { - LoyaltyEventOther, - loyaltyEventOtherSchema, -} from './loyaltyEventOther'; +import { LoyaltyEventOther, loyaltyEventOtherSchema } from './loyaltyEventOther'; import { LoyaltyEventRedeemReward, loyaltyEventRedeemRewardSchema, diff --git a/src/models/obtainTokenRequest.ts b/src/models/obtainTokenRequest.ts index d8647891..ac615834 100644 --- a/src/models/obtainTokenRequest.ts +++ b/src/models/obtainTokenRequest.ts @@ -10,14 +10,17 @@ import { export interface ObtainTokenRequest { /** - * The Square-issued ID of your application, which is available in the OAuth page in the + * The Square-issued ID of your application, which is available on the **OAuth** page in the * [Developer Dashboard](https://developer.squareup.com/apps). */ clientId: string; /** - * The Square-issued application secret for your application, which is available in the OAuth page - * in the [Developer Dashboard](https://developer.squareup.com/apps). This parameter is only required when you are not using the [OAuth PKCE (Proof Key for Code Exchange) flow](https://developer.squareup.com/docs/oauth-api/overview#pkce-flow). - * The PKCE flow requires a `code_verifier` instead of a `client_secret`. + * The Square-issued application secret for your application, which is available on the **OAuth** page + * in the [Developer Dashboard](https://developer.squareup.com/apps). This parameter is only required when + * you're not using the [OAuth PKCE (Proof Key for Code Exchange) flow](https://developer.squareup.com/docs/oauth-api/overview#pkce-flow). + * The PKCE flow requires a `code_verifier` instead of a `client_secret` when `grant_type` is set to `authorization_code`. + * If `grant_type` is set to `refresh_token` and the `refresh_token` is obtained uaing PKCE, the PKCE flow only requires `client_id`,  + * `grant_type`, and `refresh_token`. */ clientSecret?: string | null; /** @@ -26,7 +29,7 @@ export interface ObtainTokenRequest { * the application wants to exchange an authorization code for an OAuth access token. */ code?: string | null; - /** The redirect URL assigned in the OAuth page for your application in the [Developer Dashboard](https://developer.squareup.com/apps). */ + /** The redirect URL assigned on the **OAuth** page for your application in the [Developer Dashboard](https://developer.squareup.com/apps). */ redirectUri?: string | null; /** * Specifies the method to request an OAuth access token. @@ -61,7 +64,7 @@ export interface ObtainTokenRequest { */ shortLived?: boolean | null; /** - * Must be provided when using PKCE OAuth flow. The `code_verifier` will be used to verify against the + * Must be provided when using the PKCE OAuth flow if `grant_type` is set to `authorization_code`. The `code_verifier` is used to verify against the * `code_challenge` associated with the `authorization_code`. */ codeVerifier?: string | null; diff --git a/src/models/order.ts b/src/models/order.ts index 56d4dc98..1c29c96c 100644 --- a/src/models/order.ts +++ b/src/models/order.ts @@ -17,10 +17,7 @@ import { orderLineItemDiscountSchema, } from './orderLineItemDiscount'; import { OrderLineItemTax, orderLineItemTaxSchema } from './orderLineItemTax'; -import { - OrderMoneyAmounts, - orderMoneyAmountsSchema, -} from './orderMoneyAmounts'; +import { OrderMoneyAmounts, orderMoneyAmountsSchema } from './orderMoneyAmounts'; import { OrderPricingOptions, orderPricingOptionsSchema, diff --git a/src/models/orderLineItem.ts b/src/models/orderLineItem.ts index 406213d5..0cb52dbb 100644 --- a/src/models/orderLineItem.ts +++ b/src/models/orderLineItem.ts @@ -30,10 +30,7 @@ import { OrderLineItemPricingBlocklists, orderLineItemPricingBlocklistsSchema, } from './orderLineItemPricingBlocklists'; -import { - OrderQuantityUnit, - orderQuantityUnitSchema, -} from './orderQuantityUnit'; +import { OrderQuantityUnit, orderQuantityUnitSchema } from './orderQuantityUnit'; /** * Represents a line item in an order. Each line item describes a different diff --git a/src/models/orderReturn.ts b/src/models/orderReturn.ts index bfdcd232..f7251326 100644 --- a/src/models/orderReturn.ts +++ b/src/models/orderReturn.ts @@ -7,10 +7,7 @@ import { Schema, string, } from '../schema'; -import { - OrderMoneyAmounts, - orderMoneyAmountsSchema, -} from './orderMoneyAmounts'; +import { OrderMoneyAmounts, orderMoneyAmountsSchema } from './orderMoneyAmounts'; import { OrderReturnDiscount, orderReturnDiscountSchema, diff --git a/src/models/orderReturnLineItem.ts b/src/models/orderReturnLineItem.ts index a9dbf5fb..6c68e3d5 100644 --- a/src/models/orderReturnLineItem.ts +++ b/src/models/orderReturnLineItem.ts @@ -21,10 +21,7 @@ import { OrderLineItemAppliedTax, orderLineItemAppliedTaxSchema, } from './orderLineItemAppliedTax'; -import { - OrderQuantityUnit, - orderQuantityUnitSchema, -} from './orderQuantityUnit'; +import { OrderQuantityUnit, orderQuantityUnitSchema } from './orderQuantityUnit'; import { OrderReturnLineItemModifier, orderReturnLineItemModifierSchema, diff --git a/src/models/pauseSubscriptionResponse.ts b/src/models/pauseSubscriptionResponse.ts index 7ea9f1bf..cceb532b 100644 --- a/src/models/pauseSubscriptionResponse.ts +++ b/src/models/pauseSubscriptionResponse.ts @@ -14,9 +14,9 @@ export interface PauseSubscriptionResponse { /** Errors encountered during the request. */ errors?: Error[]; /** - * Represents a subscription to a subscription plan by a subscriber. - * For an overview of the `Subscription` type, see - * [Subscription object](https://developer.squareup.com/docs/subscriptions-api/overview#subscription-object-overview). + * Represents a subscription purchased by a customer. + * For more information, see + * [Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). */ subscription?: Subscription; /** The list of a `PAUSE` action and a possible `RESUME` action created by the request. */ diff --git a/src/models/payout.ts b/src/models/payout.ts index ba0b650d..00a3a049 100644 --- a/src/models/payout.ts +++ b/src/models/payout.ts @@ -54,6 +54,8 @@ export interface Payout { payoutFee?: PayoutFee[] | null; /** The calendar date, in ISO 8601 format (YYYY-MM-DD), when the payout is due to arrive in the seller’s banking destination. */ arrivalDate?: string | null; + /** A unique ID for each `Payout` object that might also appear on the seller’s bank statement. You can use this ID to automate the process of reconciling each payout with the corresponding line item on the bank statement. */ + endToEndId?: string | null; } export const payoutSchema: Schema = object({ @@ -71,4 +73,5 @@ export const payoutSchema: Schema = object({ optional(nullable(array(lazy(() => payoutFeeSchema)))), ], arrivalDate: ['arrival_date', optional(nullable(string()))], + endToEndId: ['end_to_end_id', optional(nullable(string()))], }); diff --git a/src/models/phase.ts b/src/models/phase.ts new file mode 100644 index 00000000..df1b6123 --- /dev/null +++ b/src/models/phase.ts @@ -0,0 +1,20 @@ +import { nullable, number, object, optional, Schema, string } from '../schema'; + +/** Represents a phase, which can override subscription phases as defined by plan_id */ +export interface Phase { + /** id of subscription phase */ + uid?: string | null; + /** index of phase in total subscription plan */ + ordinal?: number | null; + /** id of order to be used in billing */ + orderTemplateId?: string | null; + /** the uid from the plan's phase in catalog */ + planPhaseUid?: string | null; +} + +export const phaseSchema: Schema = object({ + uid: ['uid', optional(nullable(string()))], + ordinal: ['ordinal', optional(nullable(number()))], + orderTemplateId: ['order_template_id', optional(nullable(string()))], + planPhaseUid: ['plan_phase_uid', optional(nullable(string()))], +}); diff --git a/src/models/phaseInput.ts b/src/models/phaseInput.ts new file mode 100644 index 00000000..8f234be5 --- /dev/null +++ b/src/models/phaseInput.ts @@ -0,0 +1,14 @@ +import { nullable, number, object, optional, Schema, string } from '../schema'; + +/** Represents the arguments used to construct a new phase. */ +export interface PhaseInput { + /** index of phase in total subscription plan */ + ordinal: number; + /** id of order to be used in billing */ + orderTemplateId?: string | null; +} + +export const phaseInputSchema: Schema = object({ + ordinal: ['ordinal', number()], + orderTemplateId: ['order_template_id', optional(nullable(string()))], +}); diff --git a/src/models/qrCodeOptions.ts b/src/models/qrCodeOptions.ts new file mode 100644 index 00000000..47d6b2e4 --- /dev/null +++ b/src/models/qrCodeOptions.ts @@ -0,0 +1,20 @@ +import { object, Schema, string } from '../schema'; + +/** Fields to describe the action that displays QR-Codes. */ +export interface QrCodeOptions { + /** The title text to display in the QR code flow on the Terminal. */ + title: string; + /** The body text to display in the QR code flow on the Terminal. */ + body: string; + /** + * The text representation of the data to show in the QR code + * as UTF8-encoded data. + */ + barcodeContents: string; +} + +export const qrCodeOptionsSchema: Schema = object({ + title: ['title', string()], + body: ['body', string()], + barcodeContents: ['barcode_contents', string()], +}); diff --git a/src/models/resumeSubscriptionResponse.ts b/src/models/resumeSubscriptionResponse.ts index 9a98dbea..37cc64c5 100644 --- a/src/models/resumeSubscriptionResponse.ts +++ b/src/models/resumeSubscriptionResponse.ts @@ -14,9 +14,9 @@ export interface ResumeSubscriptionResponse { /** Errors encountered during the request. */ errors?: Error[]; /** - * Represents a subscription to a subscription plan by a subscriber. - * For an overview of the `Subscription` type, see - * [Subscription object](https://developer.squareup.com/docs/subscriptions-api/overview#subscription-object-overview). + * Represents a subscription purchased by a customer. + * For more information, see + * [Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). */ subscription?: Subscription; /** A list of `RESUME` actions created by the request and scheduled for the subscription. */ diff --git a/src/models/retrieveInventoryTransferResponse.ts b/src/models/retrieveInventoryTransferResponse.ts index b1699d5a..2f588980 100644 --- a/src/models/retrieveInventoryTransferResponse.ts +++ b/src/models/retrieveInventoryTransferResponse.ts @@ -1,9 +1,6 @@ import { array, lazy, object, optional, Schema } from '../schema'; import { Error, errorSchema } from './error'; -import { - InventoryTransfer, - inventoryTransferSchema, -} from './inventoryTransfer'; +import { InventoryTransfer, inventoryTransferSchema } from './inventoryTransfer'; export interface RetrieveInventoryTransferResponse { /** Any errors that occurred during the request. */ diff --git a/src/models/retrieveSubscriptionResponse.ts b/src/models/retrieveSubscriptionResponse.ts index 24f9e2b0..ee2ea078 100644 --- a/src/models/retrieveSubscriptionResponse.ts +++ b/src/models/retrieveSubscriptionResponse.ts @@ -10,9 +10,9 @@ export interface RetrieveSubscriptionResponse { /** Errors encountered during the request. */ errors?: Error[]; /** - * Represents a subscription to a subscription plan by a subscriber. - * For an overview of the `Subscription` type, see - * [Subscription object](https://developer.squareup.com/docs/subscriptions-api/overview#subscription-object-overview). + * Represents a subscription purchased by a customer. + * For more information, see + * [Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). */ subscription?: Subscription; } diff --git a/src/models/retrieveTokenStatusResponse.ts b/src/models/retrieveTokenStatusResponse.ts index acc4d686..cb01459e 100644 --- a/src/models/retrieveTokenStatusResponse.ts +++ b/src/models/retrieveTokenStatusResponse.ts @@ -3,12 +3,12 @@ import { Error, errorSchema } from './error'; /** * Defines the fields that are included in the response body of - * a request to the `RetrieveTokenStatus` endpoint + * a request to the `RetrieveTokenStatus` endpoint. */ export interface RetrieveTokenStatusResponse { /** The list of scopes associated with an access token. */ scopes?: string[]; - /** The date and time when the `access_token` expires, in RFC 3339 format. Empty if token never expires. */ + /** The date and time when the `access_token` expires, in RFC 3339 format. Empty if the token never expires. */ expiresAt?: string; /** The Square-issued application ID associated with the access token. This is the same application ID used to obtain the token. */ clientId?: string; diff --git a/src/models/revokeTokenRequest.ts b/src/models/revokeTokenRequest.ts index 39ca4b7c..f77b7962 100644 --- a/src/models/revokeTokenRequest.ts +++ b/src/models/revokeTokenRequest.ts @@ -2,7 +2,7 @@ import { boolean, nullable, object, optional, Schema, string } from '../schema'; export interface RevokeTokenRequest { /** - * The Square-issued ID for your application, which is available in the OAuth page in the + * The Square-issued ID for your application, which is available on the **OAuth** page in the * [Developer Dashboard](https://developer.squareup.com/apps). */ clientId?: string | null; diff --git a/src/models/searchLoyaltyEventsRequest.ts b/src/models/searchLoyaltyEventsRequest.ts index 6f4654fb..7fd0be79 100644 --- a/src/models/searchLoyaltyEventsRequest.ts +++ b/src/models/searchLoyaltyEventsRequest.ts @@ -1,8 +1,5 @@ import { lazy, number, object, optional, Schema, string } from '../schema'; -import { - LoyaltyEventQuery, - loyaltyEventQuerySchema, -} from './loyaltyEventQuery'; +import { LoyaltyEventQuery, loyaltyEventQuerySchema } from './loyaltyEventQuery'; /** A request to search for loyalty events. */ export interface SearchLoyaltyEventsRequest { diff --git a/src/models/searchOrdersRequest.ts b/src/models/searchOrdersRequest.ts index 5516e0cd..63cd39c2 100644 --- a/src/models/searchOrdersRequest.ts +++ b/src/models/searchOrdersRequest.ts @@ -8,10 +8,7 @@ import { Schema, string, } from '../schema'; -import { - SearchOrdersQuery, - searchOrdersQuerySchema, -} from './searchOrdersQuery'; +import { SearchOrdersQuery, searchOrdersQuerySchema } from './searchOrdersQuery'; /** * The request does not have any required fields. When given no query criteria, diff --git a/src/models/searchSubscriptionsRequest.ts b/src/models/searchSubscriptionsRequest.ts index ae1a512a..59a007ae 100644 --- a/src/models/searchSubscriptionsRequest.ts +++ b/src/models/searchSubscriptionsRequest.ts @@ -21,7 +21,7 @@ export interface SearchSubscriptionsRequest { * When the total number of resulting subscriptions exceeds the limit of a paged response, * specify the cursor returned from a preceding response here to fetch the next set of results. * If the cursor is unset, the response contains the last page of the results. - * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). */ cursor?: string; /** diff --git a/src/models/searchSubscriptionsResponse.ts b/src/models/searchSubscriptionsResponse.ts index c5eaf646..72886ad1 100644 --- a/src/models/searchSubscriptionsResponse.ts +++ b/src/models/searchSubscriptionsResponse.ts @@ -15,7 +15,7 @@ export interface SearchSubscriptionsResponse { * When the total number of resulting subscription exceeds the limit of a paged response, * the response includes a cursor for you to use in a subsequent request to fetch the next set of results. * If the cursor is unset, the response contains the last page of the results. - * For more information, see [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination). + * For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination). */ cursor?: string; } diff --git a/src/models/selectOption.ts b/src/models/selectOption.ts new file mode 100644 index 00000000..f79e173b --- /dev/null +++ b/src/models/selectOption.ts @@ -0,0 +1,13 @@ +import { object, Schema, string } from '../schema'; + +export interface SelectOption { + /** The reference id for the option. */ + referenceId: string; + /** The title text that displays in the select option button. */ + title: string; +} + +export const selectOptionSchema: Schema = object({ + referenceId: ['reference_id', string()], + title: ['title', string()], +}); diff --git a/src/models/selectOptions.ts b/src/models/selectOptions.ts new file mode 100644 index 00000000..735e6382 --- /dev/null +++ b/src/models/selectOptions.ts @@ -0,0 +1,19 @@ +import { array, lazy, object, optional, Schema, string } from '../schema'; +import { SelectOption, selectOptionSchema } from './selectOption'; + +export interface SelectOptions { + /** The title text to display in the select flow on the Terminal. */ + title: string; + /** The body text to display in the select flow on the Terminal. */ + body: string; + /** Represents the buttons/options that should be displayed in the select flow on the Terminal. */ + options: SelectOption[]; + selectedOption?: SelectOption; +} + +export const selectOptionsSchema: Schema = object({ + title: ['title', string()], + body: ['body', string()], + options: ['options', array(lazy(() => selectOptionSchema))], + selectedOption: ['selected_option', optional(lazy(() => selectOptionSchema))], +}); diff --git a/src/models/shiftWage.ts b/src/models/shiftWage.ts index 0521b398..cea3b973 100644 --- a/src/models/shiftWage.ts +++ b/src/models/shiftWage.ts @@ -3,10 +3,7 @@ import { Money, moneySchema } from './money'; /** The hourly wage rate used to compensate an employee for this shift. */ export interface ShiftWage { - /** - * The name of the job performed during this shift. Square - * labor-reporting UIs might group shifts together by title. - */ + /** The name of the job performed during this shift. */ title?: string | null; /** * Represents an amount of money. `Money` fields can be signed or unsigned. @@ -17,9 +14,15 @@ export interface ShiftWage { * for more information. */ hourlyRate?: Money; + /** + * The id of the job performed during this shift. Square + * labor-reporting UIs might group shifts together by id. This cannot be used to retrieve the job. + */ + jobId?: string; } export const shiftWageSchema: Schema = object({ title: ['title', optional(nullable(string()))], hourlyRate: ['hourly_rate', optional(lazy(() => moneySchema))], + jobId: ['job_id', optional(string())], }); diff --git a/src/models/signatureImage.ts b/src/models/signatureImage.ts new file mode 100644 index 00000000..e656e05a --- /dev/null +++ b/src/models/signatureImage.ts @@ -0,0 +1,16 @@ +import { object, optional, Schema, string } from '../schema'; + +export interface SignatureImage { + /** + * The mime/type of the image data. + * Use `image/png;base64` for png. + */ + imageType?: string; + /** The base64 representation of the image. */ + data?: string; +} + +export const signatureImageSchema: Schema = object({ + imageType: ['image_type', optional(string())], + data: ['data', optional(string())], +}); diff --git a/src/models/signatureOptions.ts b/src/models/signatureOptions.ts new file mode 100644 index 00000000..1194b82b --- /dev/null +++ b/src/models/signatureOptions.ts @@ -0,0 +1,17 @@ +import { array, lazy, object, optional, Schema, string } from '../schema'; +import { SignatureImage, signatureImageSchema } from './signatureImage'; + +export interface SignatureOptions { + /** The title text to display in the signature capture flow on the Terminal. */ + title: string; + /** The body text to display in the signature capture flow on the Terminal. */ + body: string; + /** An image representation of the collected signature. */ + signature?: SignatureImage[]; +} + +export const signatureOptionsSchema: Schema = object({ + title: ['title', string()], + body: ['body', string()], + signature: ['signature', optional(array(lazy(() => signatureImageSchema)))], +}); diff --git a/src/models/subscription.ts b/src/models/subscription.ts index 6040fd08..103c9d42 100644 --- a/src/models/subscription.ts +++ b/src/models/subscription.ts @@ -9,6 +9,7 @@ import { string, } from '../schema'; import { Money, moneySchema } from './money'; +import { Phase, phaseSchema } from './phase'; import { SubscriptionAction, subscriptionActionSchema, @@ -19,17 +20,17 @@ import { } from './subscriptionSource'; /** - * Represents a subscription to a subscription plan by a subscriber. - * For an overview of the `Subscription` type, see - * [Subscription object](https://developer.squareup.com/docs/subscriptions-api/overview#subscription-object-overview). + * Represents a subscription purchased by a customer. + * For more information, see + * [Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). */ export interface Subscription { /** The Square-assigned ID of the subscription. */ id?: string; /** The ID of the location associated with the subscription. */ locationId?: string; - /** The ID of the subscribed-to [subscription plan](entity:CatalogSubscriptionPlan). */ - planId?: string; + /** The ID of the subscribed-to [subscription plan variation](entity:CatalogSubscriptionPlanVariation). */ + planVariationId?: string; /** The ID of the subscribing [customer](entity:Customer) profile. */ customerId?: string; /** The `YYYY-MM-DD`-formatted date (for example, 2013-01-15) to start the subscription. */ @@ -105,12 +106,14 @@ export interface Subscription { * of `include:["actions"]`. */ actions?: SubscriptionAction[] | null; + /** array of phases for this subscription */ + phases?: Phase[]; } export const subscriptionSchema: Schema = object({ id: ['id', optional(string())], locationId: ['location_id', optional(string())], - planId: ['plan_id', optional(string())], + planVariationId: ['plan_variation_id', optional(string())], customerId: ['customer_id', optional(string())], startDate: ['start_date', optional(string())], canceledDate: ['canceled_date', optional(nullable(string()))], @@ -131,4 +134,5 @@ export const subscriptionSchema: Schema = object({ 'actions', optional(nullable(array(lazy(() => subscriptionActionSchema)))), ], + phases: ['phases', optional(array(lazy(() => phaseSchema)))], }); diff --git a/src/models/subscriptionAction.ts b/src/models/subscriptionAction.ts index b99773d5..1b5e46e0 100644 --- a/src/models/subscriptionAction.ts +++ b/src/models/subscriptionAction.ts @@ -1,4 +1,13 @@ -import { nullable, object, optional, Schema, string } from '../schema'; +import { + array, + lazy, + nullable, + object, + optional, + Schema, + string, +} from '../schema'; +import { Phase, phaseSchema } from './phase'; /** Represents an action as a pending change to a subscription. */ export interface SubscriptionAction { @@ -8,13 +17,16 @@ export interface SubscriptionAction { type?: string; /** The `YYYY-MM-DD`-formatted date when the action occurs on the subscription. */ effectiveDate?: string | null; - /** The target subscription plan a subscription switches to, for a `SWAP_PLAN` action. */ - newPlanId?: string | null; + /** A list of Phases, to pass phase-specific information used in the swap. */ + phases?: Phase[] | null; + /** The target subscription plan variation that a subscription switches to, for a `SWAP_PLAN` action. */ + newPlanVariationId?: string | null; } export const subscriptionActionSchema: Schema = object({ id: ['id', optional(string())], type: ['type', optional(string())], effectiveDate: ['effective_date', optional(nullable(string()))], - newPlanId: ['new_plan_id', optional(nullable(string()))], + phases: ['phases', optional(nullable(array(lazy(() => phaseSchema))))], + newPlanVariationId: ['new_plan_variation_id', optional(nullable(string()))], }); diff --git a/src/models/subscriptionEvent.ts b/src/models/subscriptionEvent.ts index 447eae31..09a02030 100644 --- a/src/models/subscriptionEvent.ts +++ b/src/models/subscriptionEvent.ts @@ -1,4 +1,13 @@ -import { lazy, object, optional, Schema, string } from '../schema'; +import { + array, + lazy, + nullable, + object, + optional, + Schema, + string, +} from '../schema'; +import { Phase, phaseSchema } from './phase'; import { SubscriptionEventInfo, subscriptionEventInfoSchema, @@ -12,16 +21,19 @@ export interface SubscriptionEvent { subscriptionEventType: string; /** The `YYYY-MM-DD`-formatted date (for example, 2013-01-15) when the subscription event occurred. */ effectiveDate: string; - /** The ID of the subscription plan associated with the subscription. */ - planId: string; /** Provides information about the subscription event. */ info?: SubscriptionEventInfo; + /** A list of Phases, to pass phase-specific information used in the swap. */ + phases?: Phase[] | null; + /** The ID of the subscription plan variation associated with the subscription. */ + planVariationId: string; } export const subscriptionEventSchema: Schema = object({ id: ['id', string()], subscriptionEventType: ['subscription_event_type', string()], effectiveDate: ['effective_date', string()], - planId: ['plan_id', string()], info: ['info', optional(lazy(() => subscriptionEventInfoSchema))], + phases: ['phases', optional(nullable(array(lazy(() => phaseSchema))))], + planVariationId: ['plan_variation_id', string()], }); diff --git a/src/models/subscriptionPhase.ts b/src/models/subscriptionPhase.ts index d6ee6a59..6079e163 100644 --- a/src/models/subscriptionPhase.ts +++ b/src/models/subscriptionPhase.ts @@ -9,11 +9,12 @@ import { string, } from '../schema'; import { Money, moneySchema } from './money'; +import { + SubscriptionPricing, + subscriptionPricingSchema, +} from './subscriptionPricing'; -/** - * Describes a phase in a subscription plan. For more information, see - * [Set Up and Manage a Subscription Plan](https://developer.squareup.com/docs/subscriptions-api/setup-plan). - */ +/** Describes a phase in a subscription plan variation. For more information, see [Subscription Plans and Variations](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations). */ export interface SubscriptionPhase { /** The Square-assigned ID of the subscription phase. This field cannot be changed after a `SubscriptionPhase` is created. */ uid?: string | null; @@ -32,6 +33,8 @@ export interface SubscriptionPhase { recurringPriceMoney?: Money; /** The position this phase appears in the sequence of phases defined for the plan, indexed from 0. This field cannot be changed after a `SubscriptionPhase` is created. */ ordinal?: bigint | null; + /** Describes the pricing for the subscription. */ + pricing?: SubscriptionPricing; } export const subscriptionPhaseSchema: Schema = object({ @@ -43,4 +46,5 @@ export const subscriptionPhaseSchema: Schema = object({ optional(lazy(() => moneySchema)), ], ordinal: ['ordinal', optional(nullable(bigint()))], + pricing: ['pricing', optional(lazy(() => subscriptionPricingSchema))], }); diff --git a/src/models/subscriptionPricing.ts b/src/models/subscriptionPricing.ts new file mode 100644 index 00000000..6dcae580 --- /dev/null +++ b/src/models/subscriptionPricing.ts @@ -0,0 +1,33 @@ +import { + array, + lazy, + nullable, + object, + optional, + Schema, + string, +} from '../schema'; +import { Money, moneySchema } from './money'; + +/** Describes the pricing for the subscription. */ +export interface SubscriptionPricing { + /** Determines the pricing of a [Subscription]($m/Subscription) */ + type?: string; + /** The ids of the discount catalog objects */ + discountIds?: string[] | null; + /** + * Represents an amount of money. `Money` fields can be signed or unsigned. + * Fields that do not explicitly define whether they are signed or unsigned are + * considered unsigned and can only hold positive amounts. For signed fields, the + * sign of the value indicates the purpose of the money transfer. See + * [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts) + * for more information. + */ + priceMoney?: Money; +} + +export const subscriptionPricingSchema: Schema = object({ + type: ['type', optional(string())], + discountIds: ['discount_ids', optional(nullable(array(string())))], + priceMoney: ['price_money', optional(lazy(() => moneySchema))], +}); diff --git a/src/models/subscriptionSource.ts b/src/models/subscriptionSource.ts index 377ee849..e1c4a372 100644 --- a/src/models/subscriptionSource.ts +++ b/src/models/subscriptionSource.ts @@ -1,4 +1,4 @@ -import { object, optional, Schema, string } from '../schema'; +import { nullable, object, optional, Schema, string } from '../schema'; /** The origination details of the subscription. */ export interface SubscriptionSource { @@ -7,9 +7,9 @@ export interface SubscriptionSource { * a subscription originates. If unset, the name defaults to the name * of the application that created the subscription. */ - name?: string; + name?: string | null; } export const subscriptionSourceSchema: Schema = object({ - name: ['name', optional(string())], + name: ['name', optional(nullable(string()))], }); diff --git a/src/models/swapPlanRequest.ts b/src/models/swapPlanRequest.ts index 5cfb54f8..447cb64a 100644 --- a/src/models/swapPlanRequest.ts +++ b/src/models/swapPlanRequest.ts @@ -1,14 +1,29 @@ -import { object, Schema, string } from '../schema'; +import { + array, + lazy, + nullable, + object, + optional, + Schema, + string, +} from '../schema'; +import { PhaseInput, phaseInputSchema } from './phaseInput'; /** * Defines input parameters in a call to the * [SwapPlan]($e/Subscriptions/SwapPlan) endpoint. */ export interface SwapPlanRequest { - /** The ID of the new subscription plan. */ - newPlanId: string; + /** + * The ID of the new subscription plan variation. + * This field is required. + */ + newPlanVariationId?: string | null; + /** A list of PhaseInputs, to pass phase-specific information used in the swap. */ + phases?: PhaseInput[] | null; } export const swapPlanRequestSchema: Schema = object({ - newPlanId: ['new_plan_id', string()], + newPlanVariationId: ['new_plan_variation_id', optional(nullable(string()))], + phases: ['phases', optional(nullable(array(lazy(() => phaseInputSchema))))], }); diff --git a/src/models/swapPlanResponse.ts b/src/models/swapPlanResponse.ts index 1fcb2000..ecefbe3c 100644 --- a/src/models/swapPlanResponse.ts +++ b/src/models/swapPlanResponse.ts @@ -14,9 +14,9 @@ export interface SwapPlanResponse { /** Errors encountered during the request. */ errors?: Error[]; /** - * Represents a subscription to a subscription plan by a subscriber. - * For an overview of the `Subscription` type, see - * [Subscription object](https://developer.squareup.com/docs/subscriptions-api/overview#subscription-object-overview). + * Represents a subscription purchased by a customer. + * For more information, see + * [Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). */ subscription?: Subscription; /** A list of a `SWAP_PLAN` action created by the request. */ diff --git a/src/models/teamMemberWage.ts b/src/models/teamMemberWage.ts index 3d75e9de..0b9093fb 100644 --- a/src/models/teamMemberWage.ts +++ b/src/models/teamMemberWage.ts @@ -21,6 +21,11 @@ export interface TeamMemberWage { * for more information. */ hourlyRate?: Money; + /** + * An identifier for the job that this wage relates to. This cannot be + * used to retrieve the job. + */ + jobId?: string | null; } export const teamMemberWageSchema: Schema = object({ @@ -28,4 +33,5 @@ export const teamMemberWageSchema: Schema = object({ teamMemberId: ['team_member_id', optional(nullable(string()))], title: ['title', optional(nullable(string()))], hourlyRate: ['hourly_rate', optional(lazy(() => moneySchema))], + jobId: ['job_id', optional(nullable(string()))], }); diff --git a/src/models/tender.ts b/src/models/tender.ts index db5127fc..9ea29653 100644 --- a/src/models/tender.ts +++ b/src/models/tender.ts @@ -12,14 +12,8 @@ import { additionalRecipientSchema, } from './additionalRecipient'; import { Money, moneySchema } from './money'; -import { - TenderCardDetails, - tenderCardDetailsSchema, -} from './tenderCardDetails'; -import { - TenderCashDetails, - tenderCashDetailsSchema, -} from './tenderCashDetails'; +import { TenderCardDetails, tenderCardDetailsSchema } from './tenderCardDetails'; +import { TenderCashDetails, tenderCashDetailsSchema } from './tenderCashDetails'; /** Represents a tender (i.e., a method of payment) used in a Square transaction. */ export interface Tender { diff --git a/src/models/terminalAction.ts b/src/models/terminalAction.ts index 7a4005be..874585e6 100644 --- a/src/models/terminalAction.ts +++ b/src/models/terminalAction.ts @@ -1,7 +1,26 @@ -import { lazy, nullable, object, optional, Schema, string } from '../schema'; +import { + boolean, + lazy, + nullable, + object, + optional, + Schema, + string, +} from '../schema'; +import { + ConfirmationOptions, + confirmationOptionsSchema, +} from './confirmationOptions'; +import { + DataCollectionOptions, + dataCollectionOptionsSchema, +} from './dataCollectionOptions'; import { DeviceMetadata, deviceMetadataSchema } from './deviceMetadata'; +import { QrCodeOptions, qrCodeOptionsSchema } from './qrCodeOptions'; import { ReceiptOptions, receiptOptionsSchema } from './receiptOptions'; import { SaveCardOptions, saveCardOptionsSchema } from './saveCardOptions'; +import { SelectOptions, selectOptionsSchema } from './selectOptions'; +import { SignatureOptions, signatureOptionsSchema } from './signatureOptions'; /** Represents an action processed by the Square Terminal. */ export interface TerminalAction { @@ -34,11 +53,30 @@ export interface TerminalAction { appId?: string; /** Describes the type of this unit and indicates which field contains the unit information. This is an ‘open’ enum. */ type?: string; + /** Fields to describe the action that displays QR-Codes. */ + qrCodeOptions?: QrCodeOptions; /** Describes save-card action fields. */ saveCardOptions?: SaveCardOptions; + signatureOptions?: SignatureOptions; + confirmationOptions?: ConfirmationOptions; /** Describes receipt action fields. */ receiptOptions?: ReceiptOptions; + dataCollectionOptions?: DataCollectionOptions; + selectOptions?: SelectOptions; deviceMetadata?: DeviceMetadata; + /** + * Indicates the action will be linked to another action and requires a waiting dialog to be + * displayed instead of returning to the idle screen on completion of the action. + * Only supported on SIGNATURE, CONFIRMATION, DATA_COLLECTION, and SELECT types. + */ + awaitNextAction?: boolean | null; + /** + * The timeout duration of the waiting dialog as an RFC 3339 duration, after which the + * waiting dialog will no longer be displayed and the Terminal will return to the idle screen. + * Default: 5 minutes from when the waiting dialog is displayed + * Maximum: 5 minutes + */ + awaitNextActionDuration?: string | null; } export const terminalActionSchema: Schema = object({ @@ -51,16 +89,35 @@ export const terminalActionSchema: Schema = object({ updatedAt: ['updated_at', optional(string())], appId: ['app_id', optional(string())], type: ['type', optional(string())], + qrCodeOptions: ['qr_code_options', optional(lazy(() => qrCodeOptionsSchema))], saveCardOptions: [ 'save_card_options', optional(lazy(() => saveCardOptionsSchema)), ], + signatureOptions: [ + 'signature_options', + optional(lazy(() => signatureOptionsSchema)), + ], + confirmationOptions: [ + 'confirmation_options', + optional(lazy(() => confirmationOptionsSchema)), + ], receiptOptions: [ 'receipt_options', optional(lazy(() => receiptOptionsSchema)), ], + dataCollectionOptions: [ + 'data_collection_options', + optional(lazy(() => dataCollectionOptionsSchema)), + ], + selectOptions: ['select_options', optional(lazy(() => selectOptionsSchema))], deviceMetadata: [ 'device_metadata', optional(lazy(() => deviceMetadataSchema)), ], + awaitNextAction: ['await_next_action', optional(nullable(boolean()))], + awaitNextActionDuration: [ + 'await_next_action_duration', + optional(nullable(string())), + ], }); diff --git a/src/models/updateSubscriptionRequest.ts b/src/models/updateSubscriptionRequest.ts index 44a71031..48c3a8a4 100644 --- a/src/models/updateSubscriptionRequest.ts +++ b/src/models/updateSubscriptionRequest.ts @@ -7,9 +7,9 @@ import { Subscription, subscriptionSchema } from './subscription'; */ export interface UpdateSubscriptionRequest { /** - * Represents a subscription to a subscription plan by a subscriber. - * For an overview of the `Subscription` type, see - * [Subscription object](https://developer.squareup.com/docs/subscriptions-api/overview#subscription-object-overview). + * Represents a subscription purchased by a customer. + * For more information, see + * [Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). */ subscription?: Subscription; } diff --git a/src/models/updateSubscriptionResponse.ts b/src/models/updateSubscriptionResponse.ts index 599705e7..e7dc5f44 100644 --- a/src/models/updateSubscriptionResponse.ts +++ b/src/models/updateSubscriptionResponse.ts @@ -10,9 +10,9 @@ export interface UpdateSubscriptionResponse { /** Errors encountered during the request. */ errors?: Error[]; /** - * Represents a subscription to a subscription plan by a subscriber. - * For an overview of the `Subscription` type, see - * [Subscription object](https://developer.squareup.com/docs/subscriptions-api/overview#subscription-object-overview). + * Represents a subscription purchased by a customer. + * For more information, see + * [Manage Subscriptions](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions). */ subscription?: Subscription; } diff --git a/src/models/v1PaymentItemization.ts b/src/models/v1PaymentItemization.ts index cb9311ce..e9be79c1 100644 --- a/src/models/v1PaymentItemization.ts +++ b/src/models/v1PaymentItemization.ts @@ -9,18 +9,12 @@ import { string, } from '../schema'; import { V1Money, v1MoneySchema } from './v1Money'; -import { - V1PaymentDiscount, - v1PaymentDiscountSchema, -} from './v1PaymentDiscount'; +import { V1PaymentDiscount, v1PaymentDiscountSchema } from './v1PaymentDiscount'; import { V1PaymentItemDetail, v1PaymentItemDetailSchema, } from './v1PaymentItemDetail'; -import { - V1PaymentModifier, - v1PaymentModifierSchema, -} from './v1PaymentModifier'; +import { V1PaymentModifier, v1PaymentModifierSchema } from './v1PaymentModifier'; import { V1PaymentTax, v1PaymentTaxSchema } from './v1PaymentTax'; /** diff --git a/src/models/v1Settlement.ts b/src/models/v1Settlement.ts index eb1199d3..2ba4bb4a 100644 --- a/src/models/v1Settlement.ts +++ b/src/models/v1Settlement.ts @@ -8,10 +8,7 @@ import { string, } from '../schema'; import { V1Money, v1MoneySchema } from './v1Money'; -import { - V1SettlementEntry, - v1SettlementEntrySchema, -} from './v1SettlementEntry'; +import { V1SettlementEntry, v1SettlementEntrySchema } from './v1SettlementEntry'; /** V1Settlement */ export interface V1Settlement {